当前位置:网站首页>JMeter response assertion

JMeter response assertion

2022-06-24 20:48:00 m0_ sixty-two million four hundred and ninety-six thousand nine

Assertions are also called checkpoints , You can write your expected results into the assertion , If the actual response data shows your expected results , that jmeter It is judged that the interface passes , If the actual results do not meet your expectations , that jmeter The interface fails .

  1. Response assertion : Perform Assertion Verification on the response interface of the server , To judge whether the return value of the interface obtained from the interface test is correct

  • Add assertions :
  • apply to: Usually, only one request is triggered when a request is issued , So check “main sample only” Can ; If you send a request, you can trigger multiple server requests , There is main sample and sub-sample It's too late


2. Response fields to test :
(1.) General http Respond to , Check all “ The response text ”;

(2.)url The sample is right sample Of url To assert that

Response code :http Response code , Such as 101,200,302,404,501 etc. . When we want to verify 404,501 etc. http Response code , You need to check “ ignore status”. Because when http The response code is 400,500 when ,jmeter By default, this request fails ;


3、 Pattern matching :

(1) Include : The return result includes the content you specify
(2) matching : amount to equals . When the return value is fixed , You can return a value to make an assertion , Effect and equals identical ;
(3) SubString: And “ Include ” almost , All means that the returned result includes the content you specify
(4) no : It's equivalent to taking the opposite . If the assertion turns out to be true, Check “ no ” after , The final assertion result is false. If the assertion turns out to be false, Check “ no ” after , The final assertion result is true

4、 The pattern to test : Enter the expected value of the result

  Does not match the entered expectations , It is judged that the task failed , View the result tree and mark the task result in red ;
Match the expectations entered , It is judged that the task is successful    View the result tree and mark the task result in green .

原网站

版权声明
本文为[m0_ sixty-two million four hundred and ninety-six thousand nine]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211325593794.html