I can get something like you doIfOrElse block to work…
val rnd: Random = new Random()
val RndVal = rnd.nextInt(5)
def temp: ScenarioBuilder =
scenario("test scenario")
.doIfOrElse(RndVal < 3) {
exec(http("testOne").post("[http://httpbin.org/anything](http://httpbin.org/anything)").body(StringBody("one")))
}
{
repeat(5, "n") {
exec(http("testTwo").post("[http://httpbin.org/anything](http://httpbin.org/anything)").body(StringBody("${n}")))
}
}
so I don’t think that’s the source of your problem
keep in mind though, that switching like this won’t have the results you’re after. The DSL defines immutable builders, so ALL your users will end up having the same RndVal
to avoid this, you’ll need to supply a session function to your doIfOrElse