let jsonData = pm.response.json()
for (var i=0; i<count; i++){
pm.test(“To check if all keys are present and value is NOT empty for eating”, function () {
console.log(“start_date”, jsonData.data[i].start_date)
console.log(“score”,jsonData.data[i].score)
console.log(“unit”,jsonData.data[i].unit)
console.log(“status”,jsonData.data[i].status)
pm.expect(jsonData.data[i]).to.have.property(start_date,score,unit,status);
});
}
Console is printing data but when I am saying pm.expect giving error saying
To check if all keys are present and value is NOT empty for eating | ReferenceError: start_date is not defined
@skandh-15 my mistake I posted incorrect script, but yes while printing it’s printing data but error only in pm.expect.
Still seeing same error
To check if all keys are present and value is NOT empty for eating | ReferenceError: start_date is not defined
Seems like a problem with fetching start_date value from your json response, if you could also share the response, it will help the community better understand where the problem exists in your code.