So, first things first. My experience in gatling can be measured in hours (not days/weeks/months/years) and I’m a JavaScript developer so as much as some of the Scala is familiar - i’m totally out of my depth here!
I’m trying to modify an existing code base (no existing developers around to help) where we have a test scenario that runs through a series of stages. This scenario reacts quite differently the moment the environment and load are increased as certain endpoints that return an instant response (http 200) normally, will start returning an http 303 with a referrer url that our live applications then ‘poll’ until they get an http 200. This models a back office system that may take some time to process jobs.
So, I’m trying to modify the code so it checks for either an http 200 or 303. In the case of the 200 the tests continue - in the case of the 303 i want it to loop requests against the referer url up to a maximum of 10 times checking for a certain response.
It’s KINDA working, except for the part where i try and save/check the value of the referrer response - I’m wondering if I’m making the calls correctly, or saving them in the right context etc etc. I have no idea!
{...}
.exec(
http("Submit details")
.post("http://xxxxxxx")
.formParam("1", "foo")
.formParam("2", "bar")
.check( // Status could be either 200 or 303
status.in(Seq(200, 303)).saveAs("status")
)
)
.exitHereIfFailed
.exec((session: Session) => {
println(session)
val checkStatus = session("status").as[Integer]
println("Check status: " + checkStatus)
if (checkStatus == 303){
var i = 0
var cutOff = 10