Timbo
July 21, 2016, 6:33pm
1
I am new to gatling and I was wondering how to add a second condition to asLongas
Given the following:
.exec(http("Context Data Status call")
.get(ResourcePath.DATA_STATUS)
.header("Authorization", "bearer ${accessToken}")
.check(status.is(200))
.check(jsonPath("$.status").saveAs("contextDataStatus")))
.asLongAs(session => session("contextDataStatus").as[String] == "started") {
exec(http("Status call")
.get(ResourcePath.DATA_STATUS)
.header("Authorization", "bearer ${accessToken}")
.check(status.is(200))
.check(jsonPath("$.status").saveAs("contextDataStatus")))
}
What is the efficient way of adding a second condition to make sure that it keeps looping as long as “contextDataStatus == started” or “contextDataStatus == queued” ?
Timbo
July 21, 2016, 6:49pm
2
The only way I found to get around it is to have another block of asLongas for the second condition as shown below
//Trigger Context Data status call
.exec(http("Context Data Status call")
.get(ResourcePath.DATA_STATUS)
.header("Authorization", "bearer ${accessToken}")
.check(status.is(200))
.check(jsonPath("$.status").saveAs("contextDataStatus")))
.asLongAs(session => session("contextDataStatus").as[String] == "started") {
exec(http("Status call")
.get(ResourcePath.DATA_STATUS)
.header("Authorization", "bearer ${accessToken}")
.check(status.is(200))
.check(jsonPath("$.status").saveAs("contextDataStatus")))}
.asLongAs(session => session("contextDataStatus").as[String] == "queued") {
exec(http("Status call")
.get(ResourcePath.DATA_STATUS)
.header("Authorization", "bearer ${accessToken}")
.check(status.is(200))
.check(jsonPath("$.status").saveAs("contextDataStatus")))
}