Won’t work. Users are users, not threads like in JMeter. You don’t have real users who empty their browser cache and cookies, and start all over again. This way of thinking is just a hack.
As I see it, you really want to launch multiple simulations. Then, you can for example launch Gatling from maven and set up multiple executions where you force different simulationClass.
I also need some initialization code to be run on start and this is the hack I’m using right now.
It would be nice to have a setUp/tearDown methods in Gatling… no need to be synchronous, but just a guarantee they’ll run before actual simulation.
And arguably you can make a case for scenario start/end as well.
Vuser init is used to set up things that never change: auto filters, generic global checks, picking up command line arguments, that sort of thing.
Sometimes people use that phase to log in, but that really isn’t proper practice.
Iteration start/end usually revolves around preparing information needed for the session. Pre calculation of expected values, setting up checks for usernames etc.
Transaction start/end has a lot of different uses. Custom checks of course, but also things like calculating the full transaction name, adding time measurements, postprocessing of captured values, adding extra transactions to allow measuring response times grouped by what the requirement is…
I get that, but I guess that what Jean-Philippe actually wants is hooks for setting/resetting his system under test’s state.
If that’s so, I’m a bit cautious/skeptical as there’s some many ways of doing (starting VM, launching script, calling REST API, etc) that I’m not sure that’s a stress tool concern. I also don’t want to “pollute” the JVM with things that might linger and hurt the actual stress test.
Does it really matter what he does inside each of the scenarios?
I understand that people doing things you did not anticipate makes you worry about memory pressure, but telling people to move code you don’t like to maven … won’t scale. At the very least it will stop being an option once you build a web based interface around this tool.
I’ve seen some terrible lr code before. Best you can do is make frameworks that enable people to do the right thing, and hope they will use them.
My company use shared environment to test their systems and those environments cannot be recreated automatically yet.
This is not cool because you never know in which state the environment will be.
Even if you could recreate the environments each time, I don’t think one would want to do it between each test execution.
In my case, I must make sure JMS queues are empty, flush some database tables, remove some files, etc. I know I can do this in some other scripting tool, but you know Scala would be better at this. I have currently plugged in a synchronous http client in my simulation to do these cleanup tasks just before calling setUp() with my scenarios.
Maybe I’m doing it wrong, but that seems to work well for me, I just feel many people would need to do this.