Skip to content
Advertisement

How to run a gatling test from a java code and pass the url of test in parameters of simulation?

I want to be able to pass parameters to a Gatling Simulation from a java code and specially the url of test. I use Gatling with maven method. Someone help me please.

Answer

one way would be: for example, i need to pass the URL under the test http://127.0.0.1:5000

 mvn clean gatling:test -Dfoo="http://127.0.0.1:5000"

to pick this variable in scala code:

val foo_url = System.getProperty("foo")

and to utilize this foo_url in simulation:

val httpProtocol = http
    //.baseUrl("http://127.0.0.1:5000")
    .baseUrl(foo_url)
Advertisement