Teamomc 2020-06-28
常见一些断言方法
Status code is 200 (状态码为200)
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
Code name contains a string (代码名称包含一个字符串)
pm.test("Body matches string", function () { pm.expect(pm.response.text()).to.include ("resultcode\":\"200"); });
Set a global varable (设置一个全局变量)
pm.globals.set("access", token);
Response body:JSON value check (检查JOSN的值)
pm.test("Your test name", function () { var jsonData = pm.response.json(); pm.expect(jsonData.value).to.eql(100); });