Day11课后总结

一:界面功能介绍 Day11课后总结

 二:postman日

2.1 :全局变量的使用( Globals 描述 : 通常情况下,我们共同使用的部分可以存放在全部变量里,调用的时候只需要 {{ 变量名 }} 即可 , 适用 全部的接口 比如 : 手机号归属地和天气查询

常操作Day11课后总结

 2.2:接口关联

1:接口关联的方式:json提取器

Day11课后总结

2.3 :断言

 Day11课后总结

2.4 :动态参数 描述 : 经常用于参数不能重复的数据 在 postman 中经常使用的断言有哪些 Tests 响应断言的几种方式 ( 1 ) Status code:code is 200 ( 校验响应头是否包含某个值 ) ( 2 ) response body:contains string ( 校验返回结果中是否包含某个字符串 ) ( 3 ) response body:Json value check (校验返回结果中某个字段是否等于某个 值) ( 4 ) response header:content-type header check (校验响应头是否包含某个值) ( 5 ) response time is less than200ms (校验响应时间是否少于 200ms ) ( 6 ) response body:Is equal to string (校验返回结果中是否等于该字符串)使用 少 验证接口中状态码 pm.test(" 验证状态码 ", function () { pm.response.to.have.status(200); }); // 验证返回体是否存在该字符串 pm.test("Body matches string", function () { pm.expect(pm.response.text()).to.include("Return Successd!"); }); pm.test("Your test name", function () { var jsonData = pm.response.json(); pm.expect(jsonData.error_code).to.eql(0); }); pm.test("Body is correct", function () { pm.response.to.have.body("response_body_string"); }); pm.test("Content-Type is present", function () { pm.response.to.have.header("host"); }); pm.test("Response time is less than 200ms", function () { pm.expect(pm.response.responseTime).to.be.below(10); }); {{$timestamp}}: 生成当前时间的时间戳 {{$randomInt}}: 生成 0~1000 的随机数 {{$guid}}: 生成随机的 guid 字符串 2.5: 数据驱动 描述 : 将测试数据保存本地,一次性进行运行 在参数里面的数据文件值和取全局变量一致,使用 {{}} ,在断言里面取数据文件的值使用: data. 字段名 Day11课后总结

上一篇:第九组-冲刺日志(第七天)


下一篇:秃鸡队——冲刺总结