Gatling: requests inside foreach loop not having the same number of executions

Viewed 1386

I have this script:

.foreach("${list}", "item") {
  exec(http("Req 1")
    .post("/path/to/service/one")
    .formParam("param1", "${item}")
    .formParam("param2", "somestring")
    .formParam("param3", "${param3}")
    .check(xpath("/xmlroot/id").saveAs("id"))
    .check(xpath("/xmlroot/version").saveAs("version")))
  .exec(http("Req 2")
    .post("/path/to/service/two")
    .formParam("param1", "${param1}")
    .formParam("param2", "${param2}")
    .formParam("version", "${version}")
    .formParam("id", "${id}")
    .check(status.is(200)))
  .exec(http("Req 3")
    .post("/path/to/service/three")
    .formParam("id", "${id}")
    .formParam("param1", "somestring")
    .formParam("param2", "${item}")
    .check(xpath("/xmlroot/@id").exists))
}

It executes successfully, but it reports that there are only 2 Req 2 requests executed while there are 8 of Req 1 and Req 3. I expect there to be an equal number of requests.

Any idea what could be causing this?

Edit: It seems to be completing different number of requests each run, where it only tries to run as many Req 2 requests as it can fit in the amount of time Req 1 and Req 3 runs. Are they fired simultaneously? I assumed these are fired one after the other.

Edit2: screenshot of results Here is a screenshot of one of the reports generated. It shows that Req 2 executed 75% less times, and that the requests are also around 3 times slower than Req 1 and Req 3.

Edit3: Setup and scenario:

  val scenario = scenario("Scenario")
    .exitBlockOnFail {
      exec(loginAction,
        actionThatEndsWithTheLoop)
    }

  setUp(scenario.inject(atOnceUsers(1)))
    .assertions(global.successfulRequests.percent.is(100))
    .protocols(httpProtocol)

I only run 1 user so all of the 8 iterations are expected for each of the requests.

0 Answers
Related