Hi there community! I have a problem regarding test scripts. Context: i need to collect information about test results and update xray/jira in real time, when a collection is run manually. So i used try/catch in order to update a global variable containing the test result. Here is an example:
pm.globals.set("status", 'PASSED');
pm.test("Check if response contains all the keys", function () {
try {
pm.expect(pm.response.json()).to.be.an('object').that.has.all.keys('amount', 'currency')
} catch {
pm.globals.set("status", 'FAILED')
};
});
The problem is Postman reports the test is passed, even tho pm.expect⦠is false. Has anyone a better idea how to do this and get the correct result? Thanks