I have a scenario using Groups to model actions on pages in my app.
One requirement I have is to use a copy of production data in my simulations, but this data may have problems such as missing fields etc that are required for some actions.
To handle this I've wrapped these actions in a tryMax block so that I can catch data errors on the first execution then remove problematic data from the session and retry. (there is no way to validate the data prior to making the call)
The problem is that even though the action eventually succeeds (the reports show 2 executions with one OK, the other KO), the containing group is marked as KO.
So I have something like...
group("group1") {
tryMax(2) {
exec(http("action1")
.post("someURL")
.body("${ids}")
.check(
checkIf((response: Response, session: Session) => response.status.code == 400) {
jsonPath("$..failedIds").findAll.transform(
(failed, session) => {
session("ids").as[Seq[String]].diff(failed)
).saveAs("ids")
},
status.is(201)
)
)
}
}
this works, in that 'action1' gets executed, pulls the failing ids from the 'ids' session variable, tries again and succeeds. But what I would like is for 'group1' to be marked as OK in the reports - with this solution it is KO, which is misleading from my purposes.
I'm on gatling 3.1.1
This is a bug in Gatling that will be fixed in 3.2.0, see https://github.com/gatling/gatling/issues/3738