Postman: How to check whether the field is returning null in the Postman automation

后端 未结 10 1042
借酒劲吻你
借酒劲吻你 2020-12-31 05:57

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

10条回答
  •  星月不相逢
    2020-12-31 06:38

    If you are checking the Id of the first item returned in a list, you could use not.equal(null):

    pm.expect(pm.response.json().value[0].Id).not.equal(null);
    

    Note that the word "equal" is fully spelled out, although the shortened "eql" does work.

提交回复
热议问题