Gatling 3.0.0 - findAll() producing .exists error

Hello,

I have JSON that I’m using findAll() upon, like so: https://gist.github.com/dragoonis/2168d2079f2e684f0306360d364c6d4e#file-file-scala-L11

It’s fine for the “documents” key in the JSON to be empty array, such as: “documents: []”, because I have a doif() here to check if we have documents, or not: https://gist.github.com/dragoonis/2168d2079f2e684f0306360d364c6d4e#file-file-scala-L19

This is the full JSON body:

{"limit":999,"metadata":{"doctype":[],"direction":[]},"pages":{"current":1,"total":0},"total":0,"documents":[]}

When I have a payload that’s got an empty documents array, I still get this error every time, and it fails.

> jsonPath($.documents).findAll.exists, found nothing                 1 (100.0%)

Can you please advise what should change in my script, to get all the $.documents, but not fail if it's an empty JSON array.

Many thanks,
Paul

Hi Stephane,

My project is blocked until I figure out how to stop this from happening: “findAll.exists, found nothing”

Do you have a moment to take a look?

Many thanks,
Paul

I’ve just pushed a commit demonstrating jsonPath works fine with empty arrays.
My best guess is that the JSON response you get is not the one you’re expecting.

Hi Stephane,

I’m doing .findAll() and it’s doing findAll().exists() automatically under the hood.

I need to do findAll() but disable the .exists() check because it’s allowed to not have items.

The HTTP response is:

{"limit":999,"metadata":{"doctype":[],"direction":[]},"pages":{"current":1,"total":0},"total":0,"documents":[]}

Many thanks,
Paul