postman中的断言方式

1. 字符串断言
(1)response body:contains string (校验返回结果中是否包含某个字符串)
(2)response body:Is equal to string (校验返回结果中是否等于该字符串)使用少,token会变
(3)response body:Json value check (校验返回结果中某个字段是否等于某个值)
(4)response header:content-type header check (校验响应头是否包含某个值)
(5)response time is less than200ms (校验响应时间是否少于200ms)
(6)Status code:code is 200 (校验响应头是否包含某个值)
打开postman按照图片中的
在这里插入图片描述
查看是否和字符串中的字符匹配


pm.test("Body matches string", function () {
    
    
    pm.expect(pm.response.text()).to.include("字符串");
});

错误的例子
在这里插入图片描述
响应头成功案例
在这里插入图片描述
断言的结果
在这里插入图片描述
绿色是断言过程中通过,红色是断言过程中批量执行程序不通过的

jenkins的使用

  1. 首先拿到jenkins.war包然后放到tomcat下webapps下然后运行tomcat访问localhost生成jenkins文件夹然后访问localhost:8080/jenkins在这里插入图片描述

到达解锁jenkins页面,复制路径找到密码位置然后复制密码粘贴到密码位置,配置jenkins选择安装推荐,设置用户名密码,然后成功进入到jenkins页面,
在这里插入图片描述

新建项目,
在这里插入图片描述

选择定期构建,输入H/2 * * * * 选择构建 选择执行 Execute windows batch command 输入命令 newman run C:\Users\mi\Desktop\聚合数据.postman_collection.json -r html --reporter-htmlexport report123.html 点击确认后成功成功构建项目。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
根据生成的测试报告路径找到测试报告
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44826661/article/details/123758481
今日推荐