I want to run a scenario that runs until a given condition, using doWhile.
I have a simple example:
val scn = scenario(“Read 1”)
.exec( session => session.set(“count”, 1))
.doWhile(_(“count”).as[Int] < 10) {
http(“getting: “)
.get(”/list/1/”)
.check(status.in(200,404))
}
This will run indefinitely of course, because the session attribute “count” is never incremented.
I tried to add an exec statement to increment it:
val scn = scenario(“Read 1”)
.exec( session => session.set(“count”, 1))
.doWhile(_(“count”).as[Int] < 10) {
http(“getting: “)
.get(”/list/1/”)
.check(status.in(200,404))
exec(s => s.set(“count”, s(“count”).as[Int] + 1))
}
But this causes an unsupportedoperationexception- no requests sent during the simulation.
My question is how can I increment count within the doWhile block?