Forum Discussion

readytester's avatar
readytester
New Contributor
2 years ago

Why HTTP responses with 500 and 404 status codes are marked as 'passed'?

Hi,

I am trying to use ReadyAPI to run basic functional tests but they are marked as PASSED even when the HTTP response status codes are 500 or 404, which I find strange to say the least. All responses which have 5xx or 4xx status codes should be marked as FAILED - but I do not seem to be able to find a way to do that for all test cases in one go - is there any way to do that?

Thanks a lot!

 

3 Replies

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 2

    Hi,

    ReadyAPI does not automatically class a 404 or 500 as a fail, you need to tell ReadyAPI what to do.

     

    You need to add an assertion to each service call.  There are various assertions you can apply to a test step.  E.g. check for specific content.  There are also assertions for status codes; Invalid Status Codes and Valid Status Codes.

     

    I usually do this...

    In the valid service codes assertion, I put "200".

    In the invalid service codes assertion, I put "404, 500"

    • readytester's avatar
      readytester
      New Contributor

      Hi ChrisAdams, yes I have eventually discovered that but I have more than 100+ tests - is there any way to apply the same assertion to all of them?