当前位置:网站首页>Postman common assertions

Postman common assertions

2022-06-10 16:44:00 Acridine

 Insert picture description here

One 、Response time is less than 200ms ( Response time is less than 200ms)

pm.test(“Response time is less than 200ms”, function () {
pm.expect(pm.response.responseTime).to.be.below(200);
});

Two 、Status code is 200 ( Status code is 200)

pm.test(“Status code is 200”, function () {
pm.response.to.have.status(200);
});

3、 ... and 、Check if response body contains a string ( Check whether the response body contains a string )

pm.test(“Body matches string”, function () {
pm.expect(pm.response.text()).to.include(“string_you_want_to_search”);
});

原网站

版权声明
本文为[Acridine]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101549193853.html