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

后端 未结 10 1022
借酒劲吻你
借酒劲吻你 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:47

    I have done similar, this is one part of the code and its works well Check this code

    var jsonData = JSON.parse(responseBody);
    
    for(i=0; i environment.Cstartdate;
    
    tests["response body has department name"] = jsonData.data[i].department.name !== null;
    
    }
    

提交回复
热议问题