pause depending on session variable not working


i am working on a Gatling simulation of devices, that report operational problems every now and then. Currently, I use a CSV-based feeder where each line represents a device to simulate. The file contains a column for the minimum and maximum interval when such a device incident happens.

It seems that the value cannot be used directly. I use the following construct that I found at a similar example.

val scn = scenario(“DeviceSimulation”)
.exec { session => println(session); session }
.pause(session => session(“incidentIntervalMin”).validate[Int].map(i => i seconds))


However, I get a error message that the pause failed to execute. However, it seems that the data is correctly fed into the session… This is what I get as output

Simulation ClientSimulation started…
Session(DeviceSimulation,7500573123754965476-0,Map(incidentIntervalMin → 1, tenant → A, incidentDurationMin → 20, incidentDurationMax → 30, incidentIntervalMax → 2, deviceId → 000001),1425993974910,0,OK,List(),)
14:26:14.921 [][ERROR][Actions.scala:72] i.g.c.a.Pause - ‘pause-8’ failed to execute


Btw. I use Gatling 2.1.2.


My2cents: the value behind incidentIntervalMin is a String, not an Int :wink:

Try .map(i => i.toInt seconds)

Thanks for your quick reply, I’ve changed the line to

.pause(session => session(“incidentIntervalMin”).validate[Int].map(i => i.toInt seconds))


However, this results in the same error…

16:04:08.416 [][ERROR][Actions.scala:72] i.g.c.a.Pause - ‘pause-10’ failed to execute

Since the value in session’s type is String and not Int, you’ll need to replace validate[Int] by validate[String].



Thanks for your patience. I have to admit that I started with Scala just yesterday and coming from Java some of these constructs seems like … ahm… magic to me :wink:


.pause(session => session(“incidentIntervalMin”).validate[String].map(i => i.toInt seconds)


works fine. However, when I try to pass a maximum value for pause as well, my simulation gets stuck and nothing happens.

When I use the version with constants

.pause(10, 20)


everything works fine. However, when using the values from the session the simulation seems to “hang”. The last line I see is “Simulation XYZ started…” and nothing happens

.pause(session => session(“incidentIntervalMin”).validate[String].map(i => i.toInt seconds),
session => session(“incidentIntervalMax”).validate[String].map(i => i.toInt seconds))


Indeed a bug, just fixed:

Thanks for reporting!

I see. This was more stumpling upon than reporting, but thanks anyhow :wink: