jmeter response and json assertion

jmeter affirmation

Note: If the assertion is successful, you can't see the result of the assertion on the view result, only if it fails

1. Configure response assertion

1. Add
Insert picture description here
2. Configure
Insert picture description here
3. Assertion result
Insert picture description here

2. Configure json assertion

json asserts that if the returned data is not in json format, an error will be reported directly

(Tucao, translate these sentences, this NetEase Youdao dictionary is really invalid)
Assert json path exists: Assert json path exists.
Additional assert value: additional assert value
match as regular expression: match as regular expression
expect null: expected to be empty
invert assertion (will fail if above conditions met): invert assertion (will fail if above conditions met)

Assert json path exists is written with $. as the root directory, such as data {"data":{"code": 2002, "msg": "The password length must be greater than or equal to 6 digits"}}

To get the value of code, write it as $.data.code

Example
response data
{ "code": 200, "msg": "Congratulations, registration is successful!" }


Assertion configuration
Insert picture description here

Assertion result
Insert picture description here

Guess you like

Origin blog.csdn.net/aaaaaaaaanjjj/article/details/115032757