Hi.
I would like to define a test that simply fails whenever a call returns the error “could not get any response”. Is that possible?
I simply need to detect whenever a service is not responding and fail a test.
Thanks!
Hi.
I would like to define a test that simply fails whenever a call returns the error “could not get any response”. Is that possible?
I simply need to detect whenever a service is not responding and fail a test.
Thanks!
Tests don’t run unless a response comes back.
Is there a specific request that might be down? You might be able to do something like this:
pm.sendRequest('https://invalidurl', function(err, res){
if(err){
pm.test('invalidurl is down', function() { pm.expect(false).to.be.true; });
} else {
pm.setNextRequest('invalidurl Request');
}
});
The only problem with this code is that it’s running async and your collection would continue to run. I’m not a node JS expert, so maybe there is a way to await it.
Makes sense, thanks! Some limitations of Postman seem quite annoying to me
I wanted to point out that there is a difference between the Postman App and Newman.
In Newman, even if there is no response, the tests will be executed and the collection run will fail.
Considering that I can manually observe in Postman that something went wrong, I won’t write additional code to handle this case.
Thanks!!! This is very, very good news for me.