Postman:如何在 Postman 自动化中检查字段是否返回 null [英] Postman: How to check whether the field is returning null in the Postman automation

查看:64
本文介绍了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);
)};

这篇关于Postman:如何在 Postman 自动化中检查字段是否返回 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆