1
{
    "success": {
        "text": "successfully! deleted Records"
    }
}

想要验证文本值是“成功!删除记录”

我试过这个

pm.test("Your test name", function () {
    var jsonData = pm.response.json();

    pm.expect(jsonData[0].text).to.eql("successfully! deleted Records");
});
4

1 回答 1

1

您正在尝试从 JSON 对象而不是数组中检索数据。因此,它应该如下。

pm.test("Your test name", function () {
    var jsonData = pm.response.json();    
    pm.expect(jsonData.success.text).to.eql("successfully! deleted Records");
});
于 2019-11-27T05:55:57.827 回答