Postman:如何在 Postman 自动化中检查字段是否返回 null

我已尝试使用 !== null,但即使字段返回 0 或空字符串,它也会返回 PASS.

I have tried with !== null, but it is returning PASS even when the field is returning 0 or empty string.

推荐答案

截至 2019 年 3 月有效:

This works as of Mar-2019:

pm.test("To Check if Value is Null", function() {
var jsonData = pm.response.json();
pm.expect(jsonData.<yourfield>).not.eq(undefined);
)};

相关文章