2-10断言
//定义一个变量 pm.variables.set("user","51zxw");
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); username=pm.variables.get("user"); console.log("username:",username); pm.test("check username", function () { var jsonData=pm.response.json(); console.log("user:",jsonData.json['user']); pm.expect(jsonData.json['user']).to.eql(username); }); pm.test("Response time is less than 500ms", function () { pm.expect(pm.response.responseTime).to.be.below(500); });