Skip to content

Json Assertion

Json Assertion Post Processors lets you check at runtime the HTTP responses satisfy conditions, e.g.:

  • The Json body contains a particular path,
  • A node of the Json response has a particular value.

Assertions can be graphed in bench reports.

json-assertion

The first line displays the response assertion name. This field is optional. The second line contains tab headers to access:

  • Simple Configuration, to easily generate an assertion,
  • Advanced Configuration, for more specific needs

The check button, on the right of the action, lets you validate the assertion against the selected HTTP response:

  • Green: the assertion is valid for the selected response,
  • Orange: the assertion is invalid for the selected response.

Note

The response selector, on the right, lets you choose which HTTP response is used for configuring and checking the Response Assertion. So if neither recorded responses nor Validate VU responses are available, you have to configure the Response Assertion blindly.

Simple configuration

json-assertion-simple

The Configuration tab allows you to select a node in the Json tree, the assertion will then proceed to verify that this Json node exists in all responses during runtime.

Advanced configuration

json-assertion-advanced

You can enter a Json assertion directly or use the simple mode to generate one.

Negate pattern allows for a negative search, effectively mirroring the results of the assertion.

Assert value

json-assertion-regex

Assert value allows you to also control the value of the node highlighted in the Json path field. This way you can control, not only that it exists but that it has the value you are looking for.

Use Expect null? if the value is expected to be empty. Use Is regex? to use a regex expression in the value.