A way to route on JsonPath exists or not


I’m working on Gatling 2.0.0-M3a

I have the following code (consider that “something” and “something_else” are real jsonpath) :


In fonction of the response of the service i’ve got somtimes a list and sometimes something completly different.

I would do something like :

.check(jsonPath(“something”).findAll.saveAs(“PRODUITS”) or jsonPath(“something_else”).find.saveAs(“IS_EMPTY”))

Is that possible ?

I saw a previous where it was told to route if an error code occurs, but i don’t know how to implement it.

Thanks in advance.

The only (simple) thing you could do would be to have 2 different checks
whose validation condition wouldn't be "exists" (default) but "whatever"
(renamed into dontValidate in upcoming version) and then later have doIf
blocks that would deal with each possibility.
But you won't be able to have the request fails (at least on those JsonPath
checks) if neither "something" not "something_else" match.


Thanks that’s what I’ll do.

It solve my problem.

Have fun!