Forum Discussion

hindza's avatar
hindza
New Contributor
7 years ago
Solved

HTTP Status Codes Assertion Values disappear when re-opening SoapUI

Hi All,    I'm getting some strange behavior from Soap UI.    I'm using the following script to insert a Valid HTTP Status Code Assertion, an Invalid HTTP Status Code Assertion, and a string that...
  • JHunt's avatar
    7 years ago

    You're using reflection to get access to fields that you shouldn't normally have access to instead of using the public API. For instance, you might just be altering the object in memory, but the public methods would also change the representation in the project file.

     

    Try setting the codes like this instead:

     

    testRunner.testCase.testSteps["Test Step Name"]
    .addAssertion("Invalid HTTP Status Codes")
    .setCodes("400,401,402,403,404,500")

     Always be looking at the API Docs. I found setCodes from here: https://www.soapui.org/apidocs/com/eviware/soapui/security/assertion/ValidHttpStatusCodesAssertion.html