1.安装
2.发送请求
3.断言
断言的种类:
3.1.相应状态码的校验:
pm.test("验证状态码为200", function () {
pm.response.to.have.status(200);
});
3.2.相应内容包含的字符串校验
pm.test("相应内容中期望包含的内容", function () {
pm.expect(pm.response.text()).to.include("pagesize");
});
3.3相应为json串是校验key和value值是否与期望一致
3.4相应头中包含的字段判断
pm.test("相应头中包含的字段判断", function () {
pm.response.to.have.header("Transfer-Encoding");
});