I'm new to Gatling. I'm trying to understand how to work with the Loop statements. I have a code example:
private def createGame: ChainBuilder = exec(
exec(session => session.set("number", "1"))
.asLongAsDuring(true, 15.seconds) {
exec(session => { //1
val k1 = session("number") //6
val ORDER_ID = session("ORDER_ID") //7
println(s"I am verifying something ${k1}, ${ORDER_ID}") //8
session //9
})
.exec(buildSessions) //2
.exec(http("Get specific game") //4
.get("/videogames/${number}") //5
.check(status.in(200 to 210))) //3
}
)
p.s. Seems like it's the same for all loop statements.
You're confusing build time and runtime.
First, Gatling loads the Simulation and builds the builders (such as your ChainBuilder) and generate the actual Scenario, then the different virtual users execute it and in particular execute your functions.
Note: your Session API is wrong, please check the documentation.