How to skip next successive exec if one of previous exec fails

Scenario:

using gatling version: 3.0.0

I have 4 http requests sequentially executing using exec.But if any one of http request fails ( Eg: response code 500) successive http request should not be executed or skipped. Also corresponding user execution/simulation should be stopped.

Below is the sample code for 10 parallel users.

class Reverse extends Simulation {


val scn20 = scenario("RESERVE Senario")
              .repeat(50){ 
               feed(testfile_R)
              .exec(http("CreateEP1") // Fist API
              .post("/xpon/v1/endpoint1")
              .headers(headers_10)
              .body(ElFileBody("payload1.json")).asJson
              .check(status.is(200))
              .exec(http("CreateEP2") // Second API
              .post("/xpon/v1/endpoint2")
              .headers(headers_10)
              .body(ElFileBody("payload2.json")).asJson
              .check(status.is(200)))
              .exec(http("CreateEP3") // Third API
              .post("/xpon/v1/endpoint4")
              .headers(headers_10)
              .body(ElFileBody("payload3.json")).asJson
              .check(status.is(200)))
              .exec(http("CreateEP3") // Fourth API
              .post("/xpon/v1/endpoint4")
              .headers(headers_10)
              .body(ElFileBody("payload4.json")).asJson
              .check(status.is(200)))
             }
			 
    setUp(scn20.inject(atOnceUsers(10)).protocols(httpProtocol)) 
 }

using gatling version: 3.0.0

You’re using a version from 4 years ago! You really should upgrade. The current version is 3.8.3.

You’re looking for exitblockonfail: Gatling - Scenario

1 Like