Retry - krishnenc/gatling GitHub Wiki

Some requests in a scenario might be required before processing the next ones. For example, there is no meaning in continuing with a scenario after a failed login request.

In this case, one can retry the required requests as long as they're not successful:

.loop(
  chain.exec(
    http("Login")
      .post("/login")
      .param("username", "foo")
      .param("password", "bar")
      .check(status.is(200).saveAs("authenticated"))
  )
).asLongAs((session: Session) => !session.isAttributeDefined("authenticated")