Relogin session after request fail

38 views
Skip to first unread message

Max Novikov

unread,
Jun 21, 2017, 6:25:17 AM6/21/17
to Gatling User Group
Good day, I'm currently working on seemingly simple algorythm that sends requests in "during" loop and perform logout-login action if request failed. But Gatling acts strangely on any attempts to check if request failed.

Here is the code in current state:

exec(login)
.pause(login_lower,login_upper)
.during(duration, exitASAP = false) {
tryMax(repeats){
doIfEquals(session => session.status,KO) {
println("\n\nIn the doIfEqueals\n\n")
exec(logout)
.exec(login)
}
.exec(request)
}
}.exitHereIfFailed
}.exec(logout)

After running this script Gatling prints "in the doIfEquals" before warmup and goes in after request fail and prints it again, but doesn't execute logout-login.

Tried many options like grabbing response code and comparing to 200, different locations of relogin, different condition operators, but no success for now.

Does anybody have any thoughts or advices regarding this situation?

Max Novikov

unread,
Jun 21, 2017, 6:29:12 AM6/21/17
to Gatling User Group
Gatling version is 2.2.5, forgot to add at the beginning

Max Novikov

unread,
Jun 23, 2017, 4:42:26 AM6/23/17
to Gatling User Group
At the moment I used following code with no tryMax:

doIfEquals(session => session.status,KO) {
println("\n\nIn the doIfEqueals\n\n")
exec(logout)
.exec(login)
}

Aaand it "works" - after erquest is failed session perform relogin, but continues to relogin each iteration after a single fail.

Does any one have an idea how to make gatling relogin only once after each fail?
Reply all
Reply to author
Forward
0 new messages