When creating a test scenario, I’d like to verify that for example a 404 occurs when something is incorrectly requested from the API. Is there a way to indicate that error responses, e.g. 4xx is the expected result and thus correct?
You can modify the API response status code and switch in API details, or use post-action custom scripts to make assertions
For detailed information, please check here:Postman scripts reference - Apidog Docs
Alan thanks, I did change the response type for it, but when you run a test suite it still fails that test.
It would be helpful if you could provide your steps and screenshots.
So the order here got jumbled up a bit (reverse) but as you can see I set the expected response type, added this case to a test, but the test fails. Don’t get me wrong validation works when I send the request, but my test suite fails. Maybe that wasn’t clear, sorry.
Any abnormal status code will be displayed in red.
Alan Thanks! Yeah that’s fine, but the test result displays it as failed. I’m fine it being in red, I’d just like to indicate that an abnormal response is the expected one.
Alan hmm, it no longer shows as failed (I thought for a bit it was caused by disabled postprocessors). Maybe I messed something up. Apologies for the confusion. Should it occur again and be related I’ll get back to you here.
Okay, no problem, I’ll be happy to answer your questions