Hello,
I’ve been working with gatling 2.2.2 and it is great. I was able to get almost everything I wanted accomplished with it, now I’m going for an extra goal and trying to use a dynamic number for the number of messages on an sse stream check:
.exec(sse("Set check for ${num} events")
.check(wsListen.within(GlobalObj.testRunTime())
.until(1)))
works as long as the until is an integer, but if i use a variable:
.exec(sse("Set check for ${num} events")
.check(wsListen.within(GlobalObj.testRunTime())
.until(GlobalObj.testNumberOFMessages())))
this always fails the check when the simulation is over. I’m assuming because gatling runs precompiled simulation classes, in which it will fail due to the var not being set during compilation. Is this true, and if it is, is there a way to work around it? I tried marking both the testNumberOfMessages val and the scenario val as lazy, and still the same issue.
I’ve also tried pulling the ${num} out the session with
.exec( session => {
sse("Set check for ${num} events")
.check(wsListen.within(GlobalObj.testRunTime())
.until(session("num").validate[Int].get)))
session
}
)
but this causes the check to not run?
Currently, the “until” method takes a static Int.
Thanks Stephane, are there any plans to address this, possibly with the web socket api rewrite you’ve mentioned? If not I’d be happy to fork and try to put in the feature myself.
Thanks Stephane, are there any plans to address this, possibly with the
web socket api rewrite you've mentioned?
Maybe, if it makes sense
Could you please explain your use case?
If not I'd be happy to fork and try to put in the feature myself.
Sure, go ahead.
Mmm, so that’s definitively not a standard use case / supported usage.
Usually, in order to pass such data to the simulation, you would set System properties.
It only makes sense to store data in the Sessions if it is supposed to be different from one user to another.
But it’s not the case. You’re just trying to use that as a workaround.