I have a gatling (open source version) project that is pretty simple: it randomly picks filenames from a csv feeder, then sends the contents of the file to an endpoint and validates that it is getting 200 response codes back. The files being sent are large as are the responses. Each response is like this x 500:
{
"guid1":{
"recordId":"abc",
"someThing1":"xyz",
"someThing2":"def",
"status":200,
"message":null
},
"guid2":{
"recordId":"ghi",
"someThing1":"klm",
"someThing2":"nop",
"status":200,
"message":null
},
...
}
In other words, each response has 1,000 records.
If it's not a bad idea, I'd like to assert that all 1,000 records have a "status" of 200. I would say it's a bad idea if checking these 200s would slow down the test to the point of skewing the results.
Assuming it can be done without slowing down the test, I am guessing that I would be using .check(jsonpath(something)) where i would check that the count of a query something like:
$.[?(@.status == '200')]
returns 1000. Can anyone help with this?
UPDATE:
Tried this (jsonpath worked on jsonpath.com):
.check(jsonPath("$.[?(@.status == '200')]").count.is(1000))
On run, I got this error:
jsonPath($.[?(@.status == '200')]).count.is(1000) extraction crashed: end of input expected
Tried this (jsonpath worked on some https://jsonpath.herokuapp.com/ tabs but not gatling scala tab)
.check(jsonPath("$..[?(@.status == '200')].recordId").count.is(1000))
On run, I got this, but I could see in the echoed response that the format was like the one above:
jsonPath($..[?(@.status == '200')].recordId).count.is(1000), but actually found 0