1、判断请求返回的状态为200,200就是正常

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

});        // 判断返回响应中的其它字段的值时,同样使用该方法可以实现

或者使用

tests["Status code is 200"] = responseCode.code == 200;

 

 

2、获取json数据,并校对返回值的正确性

 

var res=JSON.parse(responseBody)
tests['result是否为5']=res.result=='5';
同上也可以使用

3、判断请求返回中其它字段的值(或状态)

 

 posted on 2021-06-17 19:56  2165843  阅读(65)  评论(1)    收藏  举报