'Postman - Stop the collection runner if a an assertion associated with a test fails

As the title says, I have around 20 requests in a folder that each has some test assertion that looks at the response. I want to terminate the collection runner if one assertion fails. What happens right now is that the collection runner keeps running, something I want to avoid.

I've googled and seen that you can use some logic in tests and set "postman.setNextRequest(null);" if a test failed. However, that would mean modifying all 20 requests and adding in the logic. I estimate that my collection will grow to around 100 requests in the future, which would mean a ton of duplicated logic. If I wanted to change this logic in the future I would have to do it for all 100 requests.

Is there a nice way of doing this? Seems like very basic functionality that should be built-in....



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source