The response to the assertion Jmeter format json

When the response result is json format, with JSON Assertion easier judgment.

 

1 Right-json added assertion on request 

 

2 Edit json Assertion

 

Way to judge:

If the response is not the result of json format, fail

If you can not find json path elements, fail

If json path to find the element, do not set conditions, pass

If json path to find the elements, and do not meet the conditions, fail

If json path to find the elements, and in accordance with the conditions, pass

If json path returns an array of elements iteration to determine whether there is compliance with the conditions, there is the pass, then without fail

 

The first matching value

The value of a successful match Example:

 

Example values ​​of the matching fails:

 

 

The second regular match

Regular match is successful example:

 

 Regular failure to match Example: 

Assertion fail, suggesting expectations and actual results do not match

 

The third is expected to be null

 

 

 

 The fourth reversal, the above does not meet the pass, in line with the above there fail

 

Assertion prompted a bit strange. Feeling failed that jsonpath $ [0] .TT matches 20181019 better now. Because the match it fail.

 

 

the end!

 

When depressed, upset when, techniques and organized into blog can forget all the troubles. Technical change of mind.
 

When the response result is json format, with JSON Assertion easier judgment.

 

1 Right-json added assertion on request 

 

2 Edit json Assertion

 

Way to judge:

If the response is not the result of json format, fail

If you can not find json path elements, fail

If json path to find the element, do not set conditions, pass

If json path to find the elements, and do not meet the conditions, fail

If json path to find the elements, and in accordance with the conditions, pass

If json path returns an array of elements iteration to determine whether there is compliance with the conditions, there is the pass, then without fail

 

The first matching value

The value of a successful match Example:

 

Example values ​​of the matching fails:

 

 

The second regular match

Regular match is successful example:

 

 Regular failure to match Example: 

Assertion fail, suggesting expectations and actual results do not match

 

The third is expected to be null

 

 

 

 The fourth reversal, the above does not meet the pass, in line with the above there fail

 

Assertion prompted a bit strange. Feeling failed that jsonpath $ [0] .TT matches 20181019 better now. Because the match it fail.

 

 

the end!

 

Guess you like

Origin www.cnblogs.com/longronglang/p/11778482.html