How to stop Collection Runner on error?

Hey @michael.brooks

I believe there was an edit, that you don’t have the full view of so that’s why it might have looked confusing to you. :smiley: I wrote the wrong syntax and Kevin quite rightly, changed this for me :trophy:

The reason I normally ask for an example, either through a series of images or a sample of the code that has been written is to help bring the problem to life. Other users cannot see what you have in front of you. :smiley:

Sometimes just added a text based question/problem can lead to confusion and a series of follow up questions that could take longer to get you a solution.

The postman.setNextRequest() function is only available to control the workflow from the Tests tab of the Request and is actioned after that Request has been sent.

If your first request has failed for some reason, that’s the place to tell the runner to either continue or stop the collection run. This can also be done in a central place, like at the collection or folder level if you didn’t want to add the same code to each request.

You cannot currently stop a request from running from the Pre-request Script, you could add assertions to meet certain pre conditions that would be seen as failures but you would be able to stop the request from executing.

I would love to see more about what you’re doing, to be able to advise you on a different and more context based solution.