In a Postman GET request, I have used multiple assertions. However, if any assertion fails, Postman will stops its execution then and there and will throw an error.
Is there any way to prevent this and continue with other assertions even if any one among them fails?
pm.test(“Verify the Usage amount for Text”, function () {
pm.response.to.have.status(200);
var jsonData = pm.response.json() ;
pm.expect(responseBody.length).to.eql(3);
pm.expect(jsonData, “response is NOT empty”).not.to.be.empty;
});
like in above example, I wanted to test all 3 assertion and than fail the tests.
Currently if it fails on first assertion, it stops the test and showed the result only for first assertion without testing rest two assertions.
Hi @marcelsmit
I’m not sure what you mean by “doesn’t do a thing” … could you please share what you have tried?
Here is a screenshot of my code above working;
(Note; 2 of the try/catch statements are set to fail and then I use pm.expect.fail to fail the overall test)
Sorry for my short question without further explanation.
My point was that I used the try/catch in your example. and that didn’t do much. The earlier example of a year ago of course did well.
But now that I see your screenshot I realize I forgot something to add.: )}), count++;} with every check