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.