pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Body matches string", function () { pm.expect(pm.response.text()).to.include("成功"); }); pm.test("设置自定义规则ID", function () { var jsonData = pm.response.json(); console.info(jsonData) pm.environment.set("crID", jsonData.data.data[0].crId); });
{ "code": 200, "msg": "############", "data": { "total": 1, "pages": 1, "data": [ { "crId": "&&&&&&&", "crName": "2222", "crDefault": 0, "crRemark": "21", "rtName": "&&&&&&&", "relationRtc": null, "customRuleParamvalues": null, "ruleTemplate": null, "ruleClassification": null } ], "pageNum": 1 } }