How to run gatling from code

I would like to run the Gatling test from code. How to do it? The tutorials only talk about the command line and sbt.

Context: I would like to expand the tests. In the background, I have a special cellular connection that I need to simulate. From this simulation, I need to pass some generated identifiers to the Gatling test. I could do this by running it from my modeling application with parameters (but I don't know how yet). Another solution would also be a good answer.

I could skip the file and http://gatling.io/docs/2.1.6/cookbook/passing_parameters.html , but it's ugly.

Maybe there is a way to run the sbt task from scala code?

+5
source share
2 answers
import io.gatling.app.Gatling import io.gatling.core.config.GatlingPropertiesBuilder object Engine extends App { val props = new GatlingPropertiesBuilder props.simulationClass("your.simulation.class.goes.here") props.dataDirectory("path.to.data.directory") //optional props.resultsDirectory("path.to.results.directory") //optional props.bodiesDirectory("path.to.template.directory") //optional props.binariesDirectory("path.to.binaries.directory") //optional Gatling.fromMap(props.build) } 

Hope this helps.

+3
source

I agree that the documentation on the Gatling website does not explain this well (I was looking for it the other day), however Gatling provided an excellent sample with some documentation on how to do this:

https://github.com/gatling/gatling-sbt-plugin-demo

+1
source

All Articles