How to execute all simulations from simulations directory

Hi there!

I’m writing a task in Gradle to run all simulations. Gradle compiles the simulations with necessary dependencies.

I execute each simulation with


javaexec {
 main = 'io.gatling.app.Gatling'
 classpath = sourceSets.test.output + sourceSets.test.runtimeClasspath
 args '-df', dataDir,
 '-sf', sourceSets.test,
 '-s', gatlingScenarioClass,
 '-rf', reportsDir,
 '-m'
}

But then Gatling wants to compile simulations from source and copy them to %GATLING_HOME%\target.

How can I point Gatling to run already-compiled simulations that reside in a specific directory (e.g. build\classes\test\packageName)?

Gatling can load pre-compiled simulations as long as their binaries in the classpath.

Stéphane,

OK. Right now Gatling starts in a “query” mode (yes, even with -m) and asks for a specific simulation. We can also use the ‘-s’ switch to specify a simulation.

But is it possible to say to Gatling “run all compiled simulations you can find in a classpath / specific directory”?

W dniu czwartek, 14 maja 2015 23:13:47 UTC+2 użytkownik Stéphane Landelle napisał:

Hi Bartosz,

This is not possible from the bundle without additional scripting.
However, this is possible out of the box with Gatling’s Maven or SBT plugin.

Cheers,

Pierre

No, even with the maven and the sbt plugin, Gatling can’t autodiscover Simulations that it didn’t compile itself.
If you want to execute such precompiled Simulation that’s in the classpath, you have to explicitly pass its classname.

We could have some kind of autodiscovery mechanism à la Spring where we expect a package name, and then scan the classpath for jars, scan the zip entries, filter on the package, convert the url to class names, load the classes to check if they’re Simulations… Tedious, and I don’t know what will become of this algorithm with Java 9 because of Jigsaw. No plans for this for now.

Yeah, I have written a gradle task that recursively scans the classpath dir for classes that end in ‘Scenario.class’ or ‘Simulation.class’ and executes them one by one.
So I guess that it will have to do.

W dniu piątek, 15 maja 2015 10:41:17 UTC+2 użytkownik Stéphane Landelle napisał: