找回密码
 立即注册

推荐阅读

  • 便民服务
  • 关注我们
  • 社区新手
断言
Status code:code is 200  断言接口状态码200
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
response Body:matches string 断言响应报文体包含某个字符串
pm.test("Body matches string", function () {
pm.expect(pm.response.text()).to.include("登录密码不正确");
});
pm.test("Body matches string", function () {
pm.expect(pm.response.text()).to.include('{"code":"400","msg":"登录密码不正确!","model":{}}');
});
response Body:JNOS vlaue check  检查json值是否正确
pm.test("Your test name", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.msg).to.eql('登录密码不正确!');
});
response Body:is equal to a string  断言预期报文内容与实际报文内容一致
pm.test("Body is correct", function () {
pm.response.to.have.body('{"code":"400","msg":"登录密码不正确!","model":{}}');
response headers:content-type header check  断言响应报文头包含'content-type'字段
pm.test("Content-Type is present", function () {
pm.response.to.have.header("Content-Type");
});
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:successful post request  断言请求成功,只要状态码在列表内均为成功
pm.test("Successful POST request", function () {
pm.expect(pm.response.code).to.be.oneOf([201,202,200]);
});
status code name has string  断言状态码文本
pm.test("Status code name has string", function () {
pm.response.to.have.status("OK");
});
http://cms.duoceshi.cn/cms/manage/index.do
http://192.168.0.107:8080/cms/manage/index.do

   

   

   

   

   

   


分享至 : QQ空间
收藏

0 个回复

您需要登录后才可以回帖 登录 | 立即注册