Using Karate 1.3.1 Gatling plugin 4.2.9 I tried to retrieve the multiple gating session variables defined in the .scala file logic looks like this
val TestScenario = scenario("MultipleUser")
.exec { session =>
session.setAll(Map(
"randomNumber" -> generateRandomNumber(),
"randomUUID" -> generateRandomUUID()))}
.exec { session =>
if (session.contains("randomNumber")) {
println("myVariable exists")
println("randomNumber: " + session("randomNumber").as[Long])
println("randomUUID: " + session("randomUUID").as[String])
} else {
println("myVariable does not exist")
}
session
}
.exec(karateFeature("classpath:com/test/karate-gatling/features/test.feature"))
setUp(
TestScenario.inject(atOnceUsers(5))
My question is will I get new values of randomNumber
and randomUUID
for each virtual user in the above construct? When I tried to get the value in test.feature
with karate.get("randomNumber")
function to pass the value to the path of URL. got an null
value.
In the println randomNumber
and randomUUID
the data is the same for all 5 users. I was expecting to be different.
Could you please help me with this? Am I missing anything here?
I think you are missing the concept of karateSet()
explained in the docs. https://github.com/karatelabs/karate/tree/master/karate-gatling#chaining