Forum Discussion

M_McDonald's avatar
M_McDonald
Super Contributor
17 years ago

Contains assertion fails with ampersand (&)

I have a Contains regex assertion defined on a REST Request like this:

(?ms).*Client\s*: ${#TestCase#clientName}.+$

When the clientName contains an ampersand, the contains fails even though the result contains one (eg. M & M) in a  CDATA section.

Am I doing something wrong?

14 Replies

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    With pretty printing on, the Contains assertion fails when the content has an & because it is entitized in the response xml, but all other assertions are working.

    If I turn pretty printing off, the Contains assertion works, but then all of my Xpath Match assertions fail. Those were the assertions for which I gave the exception details.

    Sorry for the confusion, but I am in a bind in either situation.
  • Hi!

    ok.. strange.. since the exception occurs while evaluating the Contains assertion and not the xpath-assertions;

    at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.SimpleContainsAssertion.assertContent(SimpleContainsAssertion.java:82)

    therefore I still wonder if you could show the value of the Contains Assertion(s) in this testcase.. or maybe just send us the entire project!?

    regards!

    /Ole
    eviware.com
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    OK, I noticed that even when I turned pretty-printing back on, I was still getting the Xpath exceptions.

    I thought that a recent build I installed had a new Groovy release, so on a hunch I did a clean install of the latest build and voila! No more exceptions.

    Perhaps there were some jar version mismatches?
  • Hi!

    could be, if you install over an existing installation old jar files will not get removed so you might end up with multiple versions of external dependencies (like groovy, which was recently updated..)

    regards!

    /Ole
    eviware.com