4--Postman--Request&Response

//var josndata=JSON.parse(responseBody);//获取body中返回的所有参数
//tests["code"]=josndata.code===200;

 
Check if response body is equal to a string:
pm.test("Body is correct", function () {
    pm.response.to.have.body("response_body_string");
});

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");
});



 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
原文地址:https://www.cnblogs.com/lizhiyan/p/10044892.html