How to stop collection run on first fail?

Hi. Is there any way to make the Collection Runner stop at the first failed test? It seems that it always runs all requests, even if some tests fail.

My scenario: I get an authentication token with the first request and all following reqests need that token. So it does not make sense to continue if getting the token fails.

Hi
This is a scenario where you can use request workflows : Building request workflows | Postman Learning Center

Ideally you will need some sort of if/else statement as you iterate through your collection

if your test fails :
To stop a workflow, add the following code on the Tests tab of a request.

postman.setNextRequest(null);

you can take a look at an example of this in :
https://www.postman.com/postman/workspace/postman-answers/documentation/9215231-25b72aab-2c6a-4941-832d-dd47e142ff2a

1 Like