Forum Discussion

dseel's avatar
dseel
Contributor
14 years ago

Assertions with contains have stopped working

Hi:

I'm using script assertions on some test cases that look like this:

// response must be 400
assert messageExchange.responseHeaders["#status#"].contains("HTTP/1.1 400")
// confirm content type
assert messageExchange.responseHeaders.get("Content-Type").contains("application/xml")

These work fine in SOAPUI Pro 3.5.1. But I'm now trying out 3.6 Beta 2 and the assertions no longer work. It appear the contains is now behaving as an equals, because I have to change the assertions to the below to get them to pass:

// response must be 400
assert messageExchange.responseHeaders["#status#"].contains("HTTP/1.1 400 Bad Request")
// confirm content type
assert messageExchange.responseHeaders.get("Content-Type").contains("application/xml; charset=ISO-8859-1")

Here is the response header in both cases:

HTTP/1.1 400 Bad Request
Date: Wed, 11 Aug 2010 13:19:06 GMT
Server: OmniAccess 8550 WSG
Content-Type: application/xml; charset=ISO-8859-1
Connection: close
Transfer-Encoding: chunked

Let me know if this can be fixed in 3.6 beta 2.

Thanks,
Dave

6 Replies

  • Any comment on this one? This issue is holding us up from being able to use 3.6 beta 2 (for other bug fixes that have been implemented).
    Thanks,
    Dave
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,
    I'm very sorry to have kept you waiting for the answer.
    We have changed the API here in order to be able to use multiple HTTP Headers with the same name...
    We are working on solving this issue and will let you know when finished.
    Thank you for your patience.

    Regards,
    Dragica
    /eviware.com
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    Please download the latest nightly build and try asserting with

    assert ((com.eviware.soapui.support.types.StringList)messageExchange.responseHeaders["#status#"]).containsValue("HTTP/1.1 400")


    Very sorry for the inconvenience caused by changing possible larger number of assertions, but once again, changing API was needed in order to enable usage of multiple HTTP Headers with the same name.

    Regards,
    Dragica
    /eviware.com
  • koji15's avatar
    koji15
    New Contributor
    Could you post the statement for the content-type, too? I tried variations of the status code assertion, but not successfully. thx.