How to stop Collection Runner on error?

I also need to stop my collection from continuing upon a test fail. My collection has 111 requests within approx 20 folders. So it’d be great if there was an overall setting that if a test fails, abort the collection run. But if I have to add a command to each of my test tabs, I will do that.

Please help me understand how to add this command upon failure. postman.setNextRequest(null)
I am a newer postman user and am not familiar with if it can do IF statements.

Here is my test, if this fails, I want to stop the collection runner.
pm.test(“Status code is 201”, function () {pm.response.to.have.status(201);});

1 Like