randomizing pathParam value

We are making http PUT call with path param to get changed, for all users we see same url being used, are we missing something ?

Here is code

class RecordedSimulation extends Simulation {

val r = scala.util.Random

val baseurl = “/session/v”+r.nextInt(10)+"/s"+r.nextInt(10)

val scn = scenario(“RecordedSimulation”)


All request goes to PUT /session**/v0/s7** HTTP/1.1" 200 0

Can we generate different path of each user ?


I know very little about Scala but I would suspect that your baseurl value is calculated only once - at the moment of its assignment.
Not sure, but it probably can work with “def” instead of “val”.
And it should work if you just remove the variable completely and do string concatenation at the moment you call .put()

Or you can use a feeder generating you random values - http://gatling.io/docs/2.0.0-RC2/session/feeder.html



It happens because you pass final value to your scenario. You can use feeders to make it dynamic.

val r = scala.util.Random
val feeder = Iterator.continually(Map(“random1”->r.nextInt(10), “random2”->r.nextInt(10)))

val scn = scenario(“RecordedSimulation”).feed(feeder)