Hello Group,
I'm trying to do an aslongas check that seems like it should be pretty simple, but it doesn't seem to be working for me. Here's the gist:
class Demo extends Simulation
{
setUp(
scenario("Demo Start")
.exec(_.set("rs", "0"))
.exec(_.set("workflowGuid", "D1O5KIBJo4BEB1Kt"))
.exec(Test.printSession)
.exec(Test.checkCallback)
.exec(Test.printSession)
.inject( atOnceUsers(1) )
)
}
object Test {
val checkCallback: ChainBuilder = asLongAs(session => session("i").as[Int] < 10 && session("rs").as[String] != "200", "i") {
exec(
http("Look for callbacks")
.get(Constants.callbackUrl + "?workflow_id=${workflowGuid}")
.check(status.saveAs("rs"))
)
}
val printSession: ChainBuilder = exec(session => {
session.foreach(print)
session
})
}
That outputs:
Session(Demo Start,1,Map(gatling.http.cache.dns -> io.gatling.http.resolver.ShuffleJdkNameResolver@1f9ea9a7, rs -> 0, workflowGuid -> D1O5KIBJo4BEB1Kt),1529105538251,0,OK,List(),io.gatling.core.protocol.ProtocolComponentsRegistry$$Lambda$380/848102479@671ea959)16:32:18.353 [INFO ] i.g.c.c.Controller - InjectionStopped expectedCount=1
Session(Demo Start,1,Map(gatling.http.cache.dns -> io.gatling.http.resolver.ShuffleJdkNameResolver@1f9ea9a7, rs -> 200, workflowGuid -> D1O5KIBJo4BEB1Kt),1529105538251,40,OK,List(),io.gatling.core.protocol.ProtocolComponentsRegistry$$Lambda$380/848102479@671ea959)16:32:20.340 [INFO ] i.g.c.c.Controller - All users are stopped
================================================================================
2018-06-15 16:32:20 3s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=10 KO=0 )
> Look for callbacks (OK=10 KO=0 )
---- Demo Start ----------------------------------------------------------------
As you can see, the value is initially zero, then 200, but it executes 10 times. I know that I'm getting a 200 the first time I call it in this scenario but it doesn't exit the loop as expected.
I'm using gatling version 2.3.0.
Thanks in advance!