Configure gatling parameters from Jenkins

Hi everybody,

I am working with Gatling and I installed it in Jenkins.
It works good but i would like to configure my values from Jenkins.

How can i do it ?

Thanks a lot !


Which parameters do you want to override?

The ones from gatling.conf, or ones to be directly used within your Simulation class?
For both, the best way is with System properties.

Regarding gatling.conf, let’s say you have something like

foo {
bar: baz

and you want override bar value, you’d set

Regarding values within the Simulation class, such as number of users, just like in Java:
Beware that Scala has its own Int type different from Integer, so if the compiler complains it gets an Integer when expecting an Int, just converte your Integer with .toInt



Hi Stéphane,

I would like to control all parameters in my scenarios.
For example, the number of users and the baseUrl for the simulation, the feeder file, the link for the queries etc…

Simply, i don’t want to touch the code anymore.

Thank you !!

Then you’ll have to define a System property for every parameter you want to be able to set.
Good luck.

How do you use it ?


I sent you a wiki link in my first answer.

Thanks !

But i have errors. I configured the Global Properties in Jenkins and add an environment variable:


And my simulation :

val nbUsersString = System.getProperty(“users”)
val nbUsers = Integer.parseInt(nbUsersString)

Here the errors:

Simulation started...
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at scala_maven_executions.MainHelper.runMain(
	at scala_maven_executions.MainWithArgsInFile.main(
Caused by: java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(
	at java.lang.Integer.parseInt(
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
	at java.lang.reflect.Constructor.newInstance(
	at java.lang.Class.newInstance0(
	at java.lang.Class.newInstance(
	at scala.Option.getOrElse(Option.scala:108)
	... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.043s
[INFO] Finished at: Tue Oct 08 17:33:28 CEST 2013
[INFO] Final Memory: 7M/148M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /home/tomcat/.jenkins/jobs/TEST-gatling/workspace/gatling/pom.xml to /home/tomcat/.jenkins/jobs/TEST-gatling/modules/$test/builds/2013-10-08_17-33-03/archive/
En attente que Jenkins finisse de récupérer les données
channel stopped
Archiving Gatling reports...
ERROR: Publisher com.excilys.ebi.gatling.jenkins.GatlingPublisher aborted due to exception
[java.lang.IllegalArgumentException]( Could not find a Gatling report in results folder.
	at [com.excilys.ebi.gatling.jenkins.GatlingPublisher.saveFullReports(](
	at [com.excilys.ebi.gatling.jenkins.GatlingPublisher.perform(](
	at [hudson.tasks.BuildStepMonitor$3.perform(]($3.perform&entity=method)
	at [hudson.model.AbstractBuild$AbstractBuildExecution.perform(]($AbstractBuildExecution.perform&entity=method)
	at [hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(]($AbstractBuildExecution.performAllBuildSteps&entity=method)
	at [hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(]($MavenModuleSetBuildExecution.post2&entity=method)
	at [hudson.model.AbstractBuild$]($
	at [hudson.model.Run.execute(](
	at [](
	at [hudson.model.ResourceController.execute(](
	at [](
Finished: FAILURE

Thanks a lot !

My2cents: you configured your options for the JVM running Jenkins, not the one running the job.

Assuming you have a maven based job, you configured Build > Goals et options with something like “mvn clean”.
Add your -Dusers=3 there.

Also note that IMHO you’re doing something a bit ugly: setting up an int property, fetching it as a String, and converting it back again into an Int.

You can even define default values.

Great !! It works !! Thank you !!

Great news!

Have fun