Hi, I have similar problem to this one [15 Days Challenge - tester - Day 8: Collection Run in Chrome Browser Postman Account and with Newman: different results], but a little bit more complicated.
In Postman my tests are passed, but not in Newman. It seems like Newman doesn’t see name, email and uuid (e.g. responseJson.data.name) as json objects? I was trying to parse JSON in other ways but I failed. Thank you for any ideas you’d have. Below I add some screenshots.
my test:
const responseJson = pm.response.json();
pm.test(“Returns correct name, email and uuid”, function () {
pm.expect(responseJson.data.name).to.eql(pm.collectionVariables.get(“name”));
pm.expect(responseJson[‘data’][‘email’]).to.eql(pm.collectionVariables.get(“email”));
pm.expect(responseJson.data.uuid).to.eql(pm.collectionVariables.get(“uuid”))
});