Hello there,
I have a collection in which i need to abort the entire run when any test fails. While searching about this, I came across the postman.setNextRequest(null)
hack. Instead of adding this in each test, I thought of having a function in the collection’s test and simply call that function each time.
Accordingly, I wrote the below:
utils = {
check_abort: function(is_failure){
if (is_failure){
postman.setNextRequest(null);
}
}
};
And in each test, I set the is_failure
and call utils.check_abort
. Now the call goes into the function, but the execution does not stop on that request, it goes ahead.
On the other hand, if I write this in the request’s test itself, the execution stops:
if (is_failure){
postman.setNextRequest(null);
}
I am not sure what am i missing here.
I just need an elegant way of stopping runs when even a single test fails.
Thanks you.