user3834163 user3834163 - 2 years ago 255
JSON Question

Jmeter assert return results are not empty or empty

I am new to JMeter. I have an AJAX app. At some point there is a query that checking the data based on the distance criteria. If the distance is too short, the return is no results in the following JSON format:

. If the distance range is big enough, the data is populated and returned as JSON Array.

I am trying to put the assertion to know when there is results or when there is no results, i.e.
. How to do this?

I tried JSON Path
and Value
. I also tried Expected
. These doesn't work. Any help is greatly appreciated. I feel I will need to write the shell script, but feel it can be complicated.

Also our app is a bit not standard from what I saw. JSON doesn't start with
, it starts with

Answer Source

Testing for an empty match is fairly simple, all you need is:

  • Use a wildcard expression: $.* as JSON Path
  • Paste exact empty response into "Expected Value", any extra space or empty string will cause assertion failure.

JSON Path Assertion


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download