[英]How to set failed in POSTMAN Collection runner via script
How can I set a "FAILED" via script? 如何通过脚本设置“失败”? I have a IF and in this if I want to check is X compare to Y. If not I want to get an "FAILED".
我有一个IF,如果要检查X是否与Y比较。如果不是,我想得到“ FAILED”。 For now I get an "FAILED" in my console but the test is "PASS".
现在,我的控制台中显示“ FAILED”,但测试为“ PASS”。 I already searched other sites but found nothing about this.
我已经搜索了其他站点,但未找到任何相关信息。 Hope u now what I mean.
希望你现在我的意思。
if(pm.iterationData.get("ProfileSeries") == response.ProfileSeries){
console.log("expProfileSeries " + pm.iterationData.get("ProfileSeries") + " = "+ response.ProfileSeries);
}
else{
console.log("FAILED");
}
Add pm.test
with relevant pm.expect
: 添加
pm.test
和相关的pm.expect
:
pm.test('ProfileSeries should be equal', function () {
pm.expect(pm.iterationData.get("ProfileSeries")).to.equal(response.ProfileSeries);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.