Gatling xpath checks - random behavior

Hi,

I’m seeing a random behaviour after enabling xpath checks for a bunch of scenarios in my Gatling simulation.

Setup:

  • I use a config file to define list of scenarios for a simulation and create the scenarioList in a loop.
  • The HttpChecks are added to the scenarios (after reading the xpath from config file)

The same simulation when run multiple times gives random results. i.e in a few tests, the xpath asserts to nothing (though the session info printed with response has the value). This is not consistent every time, and few times another scenario fails. This is with constant application - code & simulation code.

This smells something concurrency or issue with my simulation setup.

HttpChecks setup

`

val assertXpath = “” + scenarioConfig.getString(“assert-xpath”) + “”
val assertXpathNSKeyList = scenarioConfig.getString(“assert-xpath-namespaces-key”).split(",").toList
val assertXpathNSValList = scenarioConfig.getString(“assert-xpath-namespaces-val”).split(",").toList
val assertXpathNSList = assertXpathNSKeyList zip assertXpathNSValList
val assertValue = “” + scenarioConfig.getString(“assert-value”) + ""val checks = mutable.MutableListHttpCheck
checks += status.is(200)
checks += xpath(assertXpath, assertXpathNSList).is(assertValue)

`

Scenario Builder

`

for (i <- 0 to testConfigs.size - 1) {
scenarioBuilder = scenario(scenarioName)
  .feed(csv(feedData))
  .during(Integer.valueOf(scnTestDuration) seconds)(
    pace(Integer.valueOf(scnPace) seconds)
      .exec(
        http(scenarioName)
          .post(postUrl)
          .body(ELFileBody(template))
          .headers(common_header)
          .header("Content-Type", contentType)
          .check(checks: _*)
      )
  ).pause(Integer.valueOf(envConfig.getString("pause")) seconds).inject(
  rampUsers(usersForScenario)
    over (Integer.valueOf(envConfig.getString("ramp-up-duration")) seconds)
).protocols(httpProtocol)
}

`

Full code:
https://gist.github.com/jebuselwyn/c6b30cfd6e8c5a84e7d8#file-samplesimulation-scala

Thanks,
Jebu.

Hi,

I’m afraid the only way to investigate this is for you to provide a sample app to reproduce.

Cheers,

I’m doubtful if i can extract a slimmed down version of this to be able to reproduce this issue.

But just a trial with enabling just ‘is’ check seems to work, whereas ‘in’ was giving the inconsistent behavior.

(i.e) Updating my config file to look for single-value seems to work consistently. For multi-valued, i use the ‘|’ separated values, which goes through the ‘in’ condition check which seems to result in ‘found nothing’ block erratically.

`

Without a reproducer exhibiting the issue, there isn’t much we can do on our side.
As far as we can tell, the issue could perfectly be in your application.