postman断言方法

postman一共有8种断言方式postman的断言方式//八种断言方式1、断言返回码为200(*****)状态断言pm.test("Status code is 200", function () {pm.response.to.have.status(200);});2、断言返回的结果中包含有指定的字符串(*****)业务断言pm.test("Body matches string", function () {pm.expect(pm.response.tex.
摘要由CSDN通过智能技术生成

postman一共有8种断言方式

 postman的断言方式

//八种断言方式

1、断言返回码为200(*****)状态断言

pm.test("Status code is 200", function () {

pm.response.to.have.status(200);

});

2、断言返回的结果中包含有指定的字符串(*****)业务断言

pm.test("Body matches string", function () {

pm.expect(pm.response.text()).to.include("tags");

});

3、对返回的结果做json字段检查(*****)业务断言

pm.test("Your test name", function () {

var jsonData = pm.response.json();

pm.expect(jsonData.tags[0].id).to.eql(2);

});

4、断言返回的结果等于一个字符串(*****)业务断言

pm.test("Body is correct", function () {

pm.response.to.have.body("response_body_string");

});

5、断言响应头中包含有指定的响应头


                
  • 2
    点赞
  • 65
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值