一、Response time is less than 200ms (响应时间小于200ms)
pm.test(“Response time is less than 200ms”, function () {
pm.expect(pm.response.responseTime).to.be.below(200);
});
二、Status code is 200 (状态码是200)
pm.test(“Status code is 200”, function () {
pm.response.to.have.status(200);
});
三、Check if response body contains a string (检查响应主体是否包含字符串)
pm.test(“Body matches string”, function () {
pm.expect(pm.response.text()).to.include(“string_you_want_to_search”);
});