8. Jmeter's response assertion

There is a component in jmeter called Assertion, which is similar to the checkpoint in LR; it is used to check whether the response data obtained in the test meets expectations, and to ensure that the data interaction during the performance test is consistent with expectations.
The purpose of using assertions: add a layer of judgment mechanism to the return level of the request; because the request is successful, it does not mean that the result is correct. So through the assertion, we will be confused by 200 if we are not there, and we can see if our request is truly successful through the assertion!
How to use:
1. Add an assertion to a request
2. Add a corresponding assertion result listener
How to add: Right-click request-assertion-response assertion

Insert picture description here
Apply to: for whom
1. Main sampler and sub-sampler
2. Main sampling unit
3, sub-sampler
4, variable
Insert picture description here
corresponding fields to be tested from where to find, usually in response text
Insert picture description here
pattern matching rules: you can choose the appropriate mode
mode to test: what we need to match
Insert picture description here
all good choice after we If you want to see the result of the assertion, you need to add a listener-assertion result.
Right-click the thread group-listener-assertion result.
Insert picture description here
Insert picture description here
Seeing this means that the assertion is successful.
Let's take a look at the result of the assertion failure;
here we write a response that will not be included Result
Insert picture description here
Then go to request and see the result; if the
Insert picture description here
Insert picture description here
assertion is wrong, it will report such a message, that is, Haohao cannot be found in the response.

Friends can try other combinations to see what effects they have!

Guess you like

Origin blog.csdn.net/weixin_45608577/article/details/108589990