Run single user scenario after multi user scenario

Hi,

I have a scenario where I simulate multiple users performing a large number of requests to a service. The service records all the transactions it receives so that I can verify
a) that the correct requests have been received by the service
b) that the correct response was sent by the service

The server needs to have its records reset before the simulation starts and then the multi user scenario is run. Once the multi user scenario is completed I would like to add a final check to get the recorded transactions form the service (there is a GET url for this). initially I added an exec at the start and a check() at the end of the main scenario, but this ran when each user had finished and so gave failed checks (to be expected of course). What I need to do is to be able to execute a single user reset at the start of the simulation and a single user check operation after all the users have finished in the first stage. Is this possible without running three separate scenarios?

I have also tried creating three exec chains in the simulation but they do not seem to be run in a strictly sequential order, i.e. it seems as if all three scenarios are run concurrently.

E.g.
Reset(single user) → LoadTest(100 users) → Check(single user)

Also I am using gatling-sbt to run Gatling and the simulations.

Many Thanks,

RC

Hi,

IMHO, handling system under test state is not a responsibility of the stress tool, so we don’t have such before/after hooks. Handling state is something very specific to the application and might involve restoring a database, a filesystem, a cache, etc.

If I were to use Gatling as a way to achieve this because it’s convenient for a given use case, I’d personally go with 3 different simulations and run them sequentially just like you did.
If you really want to have them in one single simulations, you can hack with delay: start the second scenario with a delay of the estimation first scenario duration, and do the same thing for the second one.
https://github.com/excilys/gatling/wiki/Advanced-Usage#wiki-multi-scenario

Cheers,

Stéphane

Hi,

I will setup some scripts to perform the reset & gather steps either side of the main simulation. This is as you say a cleaner solution and not really a job for the stress test tool.

Many Thanks,

RC

Hi,

Yeah, that’s the best way IMO.

Good luck,

Stéphane