Passing parameters to scenario

Hi folks

Hoping someone here can help me out. I’m having some trouble passing parameters to a scenario in 2.0, as outlined here:

In v1.5.6 I was able to pass a parameter like this:

val iterations = Integer.getInteger(“iterations”, 20)

then pass it to a repeat in my scenario like this:


In RC2, however, when I do this I get the following:

type mismatch;
found : Integer
required: io.gatling.core.session.Session => io.gatling.core.validation.Validation[Int]

Is there a correct way to create the Map the error is asking for, or is there a different way of passing the parameter in 2.0 that I’m missing?

Similarly, the example in the docs shows a Long being passed to ‘rampUsers() over()’, but it appears that now a FiniteDuration has to be passed, so it seems like the way the values in the scenario are parsed has changed.

Thanks in advance for any advice!

Hi Alex,

Since the number of iterations does not depend on the user’s session’s content, you can use :

val iterations = Integer.getInteger(“iterations”, 20).toInt // Convert it to a Scala integer

repeat(_ => iterations) {


To make it work.

rampUsers(…) over (…) takes :

  • An Int for the rampUsers(…) parameter
  • A FiniteDuration for the over(…) parameter
    However, there are automatic conversions from java.lang.Integer to both types, so that you can write :

rampUsers(Integer.getInteger("usersRamp") over (Integer.getInteger("rampTime").seconds)

Hope this helps !



After checking, my example for repeat is overly complicated: as long as iterations is a Scala Int (meaning you call toInt on it), you can do :

repeat(iterations) {


Awesome! Thanks =)