postman断言
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
// 校验json格式的响应体的值
// pm.test("断言result", function () {
// var jsonData = pm.response.json();
// pm.expect(jsonData.result).to.eql(0);
// });
pm.test("断言result,msg,data", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.result).to.eql(0);
pm.expect(jsonData.msg).to.eql("success");
});
// 定义环境变量
pm.environment.set("message", pm.response.json().msg);
// 定义全局变量
pm.globals.set("name", "tom");