How can I stop a runner after 3 of 10 iterations

Doesn’t look like it’s possible which is strange as you would think this would be a basic feature for a test runner for data driven tests (to either bail outright, or bail after a % of failures).

How to stop all request in Collection Runner on any error? - Help - Postman

How to stop Collection Runner on error? - Just getting started - Postman

There is an option of storing your test data in an array and using array shift and sendRequest().

Using array shift() you can retrieve the first element in the array and also delete the element at the same time. You save the updated array back to an environment or collection variable and use SendRequest() to run the same request repeatedly while the array is larger > 0.

Using this method, the sendRequest(null) would kill the entire loop, so you can error handle the response and bail if needed. (Not just when the array gets to zero).

The following shows an example of the logic involved.

Post Looping through an Array not working - Help - Postman

1 Like