Search code examples
soapui

Make soapUI test case fail when HTTP error code is returned


I'm using soapUI 4.5.1 and want to set up a test case like so (using REST requests that are already in the project):

  • Authenticate to the server, receive cookie
  • Request another resource that is only available when authenticated

The problem I have is that the requests still show up as [FINISHED] even if the server returned HTTP 400, for example. In the test case options, I've found the setting "Fail on error" which is enabled. Any way to fail when the HTTP return code is not 200-ish ?


Solution

  • Add a "Valid HTTP Status Codes" Assertion to the request, it takes a list of HTTP Response codes that are considered valid and asserts otherwise.

    There is also a "Invalid HTTP Status Codes" Assertion which asserts if the response is in the list.

    SOAPUI Getting Started with Assertions