ATLANTBH jmeter-components: JSON Path Assertion ATLANTBH jmeter-components: JSON Path Assertion json json

ATLANTBH jmeter-components: JSON Path Assertion


Looks like you can easily assert both 1009 and SOME RANDOM MESSAGE values using JSONPath expressions (in JSON Path Assertion components) but not sure about 123456789: that's not node value but bode name, and JSONPath implementation used by these components seems has no expressions to get node name.

Suppose you can easily use to assert 123456789 instead binding of JSON Path Extractor (from the same components collection) with jmeter's standard Response_Assertion.

  1. Add 2 JSON Path Assertions as children to the sampler which returns json response you want to process:

    enter image description here

    enter image description here

    Expressions will be $.result.errors..code and $.result.errors..error correspondingly.

  2. Add JSON Path Extractor as child to the same sampler to extract full error entry:

    enter image description here

    Expression: $.result.errors..
    This will extract {"123456789":{"error":"SOME RANDOM MESSAGE","code":1009}} and save into the pointed variable (${errorKey}).

  3. Add Response Assertion as child to the same sampler, after previously added JSON Path Extractor:

    enter image description here

    This will assert name of the key (123456789) in the value of ${errorKey} variable.


So the final construction may look like

...YOUR Sampler    JSON Path Extractor    JSON Path Assertion    JSON Path Assertion    Response Assertion...