I’m trying to use the below syntax to trigger a GET call within a test, and perform some tests on the response.
pm.test(`example GET call`, () => {
pm.sendRequest(`https://postman-echo.com/get`, (error, response) => {
pm.expect(response).to.have.property('code', 201);
});
});
This works fine as long as the tests passes. However, when the expect fails I don’t get a red block marking the test as failed. Instead I get the below error and the test run completely stops.
The log also doesn’t give me much to work with
When I do the same test from a separate Postman Request I do get the result I’m expecting
How can I make it so the test fails as shown above, when triggering the call within a test?