Programmatically invoking Gatling with dynamic scenarios


I want to use something like Cucumber JVM to drive performance tests written for Gatling.

Ideally the Cucumber features would somehow build a scenario dynamically - probably reusing predefined chain objects similar to the method described in the “Advanced Tutorial”, e.g.

val scn = scenario("Scenario Name").exec("foo"), Browse.browse, Edit.edit("foo", "bar")

I’ve looked at how the Maven plugin executes the scripts, and I’ve also seen mention of using an App trait but I can’t find any documentation for the later and it strikes me that somebody else will have wanted to do this before…

Can anybody point (a Gatling noob) in the direction of some documentation or example code of how to achieve this?


For the sake of sharing the information here, here’s a copy of my answer on SOF:

"Sadly, it’s not currently feasible to have Gatling directly start a Simulation instance.

Not that’s it’s not technically feasible, but you’re just the first person to try to do this. Currently, Gatling is usually in charge of compiling and can only be passed the name of the class to load, not an instance itself.

You can maybe start by forking and io.gatling.core.runner.Runner, and then provide a PR to support this new behavior. The former is the main entry point, and the latter the one can instanciate and run the simulation."

I wrote a simulation generatior that uses gherkin feature files to define the test. The simulation is thus throwawa, however you do need objects in place for the requests