isADon
isADon

Reputation: 3673

Gatling tryMax reporting error even if the retry was successful

I have following scenario

  .tryMax(10) {
    pause(200 millis)
    exec(
      http("monitor status")
        .get("/${orderId}")
        .headers(sentHeaders)
        .check(status is 200)
        .check(jsonPath("$.status").is("SUCCESSFUL"))
    )
  }
  // next request

I expect this to call my endpoint up to 10 times until the condition status=SUCCESSFUL is met. It does this correctly and only executes the next request after the condition is met. However, the test result still reports it as a failure.

---- Errors --------------------------------------------------------------------
> jsonPath($.status).find.is(SUCCESSFUL), but actu    992 (100.0%)
ally found ACCEPTED

Why is it reporting the request inside the tryMax as an error?

Upvotes: 3

Views: 992

Answers (1)

Stéphane LANDELLE
Stéphane LANDELLE

Reputation: 6623

That's the expected behavior for tryMax.

Use an asLongAs loop and a non failing check where you would save the extracted value to be used for the loop condition.

Upvotes: 1

Related Questions