I'm working with a API project and using Postman for testing APIs. I wrote few test cases to check null as follows,
//user id is present
pm.test("user id is present", function() {
pm.expect(jsonData.data[0].userId).not.eql(null);
});
Also tried with .not.equal()
as described in this answer.
//user id is present
pm.test("user id is present", function() {
pm.expect(jsonData.data[0].userId).not.equal(null);
});
However, this all are getting passed even if the userId is null
. Any furhter thought to check null value in Postman test case?
.to.not.be.null
? chaijs.com/api/bdd/#method_null But it always says in the docs that this is not recommend... – Amye.to.not.be.null
however, no luck so far. Yes, I checked doc already, but then what is alternative? – Fajardo