Assertion method in postman

1. String assertion
(1) response body:contains string (check whether the returned result contains a certain string)
(2) response body:Is equal to string (check whether the returned result is equal to the string) use less , the token will change
(3) response body: Json value check (check whether a field in the returned result is equal to a certain value)
(4) response header: content-type header check (check whether the response header contains a certain value)
(5) response time is less than 200ms (check whether the response time is less than 200ms)
(6) Status code: code is 200 (check whether the response header contains a certain value)
open postman according to the picture to
insert image description here
see if it matches the string character match


pm.test("Body matches string", function () {
    
    
    pm.expect(pm.response.text()).to.include("字符串");
});

Error example
insert image description here
Response header success case
insert image description here
Assertion result
insert image description here
Green is the assertion process passed, red is the batch execution program failed in the assertion process

Use of jenkins

  1. First get the jenkins.war package and put it under webapps under tomcat and then run tomcat to access localhost to generate the jenkins folder and then access localhost:8080/jenkinsinsert image description here

Reach the unlock jenkins page, copy the path to find the password location, copy the password and paste it into the password location, configure jenkins to select the installation recommendation, set the username and password, and then successfully enter the jenkins page,
insert image description here

New Project,
insert image description here

Select Periodic Build, enter H/2 * * * * Select Build and select Execute windows batch command Enter the command newman run C:\Users\mi\Desktop\Aggregate data.postman_collection.json -r html --reporter-htmlexport report123.html After clicking OK, the project was successfully built successfully.
insert image description here
insert image description here
insert image description here
insert image description here
Find the test report based on the generated test report path
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44826661/article/details/123758481