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â))
});