Ignoring failure when retry succeeds


I’m doing load testing on a combination of two services. The first one occasionally fails, but succeeds on retry. As long as it succeeds after not too many retries, this is OK. If the service fails too many times, or if the second service fails, then I’d like to report this as a failure. I’m trying to set this up using .check on the first service, inside a tryMax block, and while it does retry the failing call, continuing to the second service, the intermittent failure is counted as a KO, and Gatling exits with exit code 2, indicating a failure.
Is there a way to get Gatling to ignore the intermittent failures of the first service completely, so that I can use the exit code to tell if there was a severe failure?

Best Regards
Magnus Reftel


You can make a check optional and save the result (status code etc) but AFAIK Gatling doesn’t currently support being able to programmatically pass or fail a transaction (that would be really handy IMO).

I’m sure it’s possible if you dig down into the source but I just haven’t had the time to look into it.

Please share your solution if you manage to crack this one!


Thanks for the suggestion! I ended up with doing a version of that: first do the request and save the value I’m interested in as a session variable via an optional check, and then do the same request again (this time without the optional in the check) inside a doIf that checks whether the session variable is set. Could probably use a repeat to get a configurable number of retries, but a single one is good enough for now =)