Skip to an exec upon check failure

I have a series of execs and one them in the middle is failing due to a check() that fails. Is there a way to skip to a later exec if that happens? Right now it just stops at that point and doesn’t call the rest of the execs in the chain.

You can wrap the call with a doIf where you would check if the previous saveAs was successful. Have a look at Gatling EL exists().

Thanks for the tip. Here is a snippet of the code. I’m trying doIfOrElse. What I’m seeing is that the else block does execute (println(“Request App Generation failed”)), but the last exec where it tries to delete the app fails because app_id is not found. Is there a reason why this variable is now gone? Do I lose session variables if a check fails? It is set in an earlier exec before the ones I pasted.


//… more execs above
// User clicks on the download code button


.exec(http(“Request App Generation”)





.doIfOrElse(session => session(“job_id”).asOption[String].isDefined) {

// UI is periodically polling the generation status of the app

// We decide to enforce a timeout here whereby the user experience would be deemed poor

exec(_.set(“generation_start”, System.currentTimeMillis()))

.asLongAs(session => {

val status200 = session(“app_generation_status”).as[Int] != 200

val nonEmptyZip = session(“zip_length”).as[Int] > 0

val timedout = session(“attempts”).as[Int] > credentialsAttempts

// as long as we haven’t gotten our non-empty success, keeping trying until timeout

(!status200 || !nonEmptyZip) && !timedout

}) {

exec(http(“Fetch Generated App (Until Completed)”)




// if we’ve reached the timeout limit, we must check if the status is 200 or fail this response

.check(checkIf((r: Response, session: Session) => session(“attempts”).as[Int] == generationAttempts) {


.check(checkIf((r: Response, session: Session) => session(“attempts”).as[Int] == generationAttempts) {





.exec(session => session.set(“attempts”, session(“attempts”).as[Int] + 1))


.exec { session =>

val start = session(“generation_start”).as[Long]

val diff = System.currentTimeMillis() - start

println("------ " + starterName + " ------")


println(diff / 1000.0)




} {

exec { session =>

println(“Request App Generation failed”)




// User deletes the app (here more for cleaning/completness purposes)

.exec(http(“Delete App”)


.queryParam(“delete_associated_resources”, “true”)

.queryParam(“deleteAssociatedResources”, “true”) // workaround for old bug still in staging



.exec { session =>





It’s not possible that an attribute disappears. Check that it was properly set/captured in the first place.

Yes I did confirm because everything up to the doIfOrElse relies on that attribute. It’s only after the check fails that the attribute is not found.

Please provide a standalone reproducer against a public website.