Forum Discussion

mmoser18's avatar
mmoser18
Frequent Contributor
9 years ago

Contains-Assertions suddenly not matching any more?!

I am having a very odd bug that suddenly many of my assertions which used to work fine suddenly indicate mismatches even though the responses actually *DO* match. I tried to analyze and boil things d...
  • mmoser18's avatar
    mmoser18
    9 years ago

    Nevermind! We found the reason!

    A colleague of mine had reformatted ("pretty printed") the soapui-project.xml file (for whatever reason...).

    Interestingly soapUI had survived the procedure (i.e. the file was still readable) but the formatting of the strings used in the assertions was gone (i.e. all line breaks of assertion strings were lost) and hence the assertions didn't match any more.

     

    While trying to understand why things didn't match anymore, I saw that all comparisson strings were on a single line and hence thought, that one would need to take the raw-string for the comparisson. But one actually needs to take the formatted string instead! If one pastes the formatted string into the assertion's contains-field, then the assertion matches! Due to that I realized that someone must have "flattened" all assertion patterns.

     

    After realizing this and tracing down the "culprit" we reverted to a version just prior before that reformatting and everything was back to normal.

     

    Thanks and regards,

    M.

     

    BTW: an observation I did during my analysis: you do funny escaping of XML characters inside token strings!

    Only '<' is escaped as &lt; while '>' is not replaced by &gt; as it should. Thus, e.g. "<foo>" as a pattern is stored in your soapUI project file as '...<token>&lt;foo></token>...'. This is actually invalid XML, but astonishingly your parser consumes that without problems...