Here is what I want to achieve - when the VU is assigned the scenario, I want that VU to log in with a set of random credentials (provided by a
SharedArray), then, and only then, start iterating.
Unfortunately, there does not seem to be a way of doing this - scenarios do not have their own lifecycle. So, when I set the scenario to do multiple iterations, it logs in once for each iteration.
The only way that I can think of to achieve my desired outcome is to put the user’s workload in a for loop, have each VU do only one scenario iteration and control the workload iterations with a global or environment var.
Am I missing something?
Sorry for the late reply
As you’ve already found out, it is indeed not yet possible to perform
setup/teardown per scenario, natively, yet. We have a GitHub issue tracking this issue already, but no estimated date of arrival yet. The implementation of that feature depends on the resolution of a bunch of issues that we haven’t addressed yet.
I’m not entirely certain that I understand the exact scenario setup you intend to use. Would you be able to post an (anonymized) example illustrating your goal (showing for instance how your scenarios are defined, etc)?
Regardless I believe there might be a few workarounds that you might find useful:
Let me know if that’s helpful, and if you have a more concrete example of what you’re trying to achieve
My turn to apologise for the delay.
Here is a simple example
The environment has multiple agencies and each agency has multiple users. I want to run multiple scenarios in parallel and each VU in each scenario should use a random agency and user. Once they are logged in, they can start iterating.
Here is a bit of the utility that I use to set the environment variables that each scenario ends up using for the iterations -