Community, I'm trying to add an assertion for an XML Response that verifies the size of the info of one of the tags. So for example, this is my response:

<description>This is your password</description>

And I would like to write an script assertion that checks if the size is null (empty xml tag) or if it has data, then checks the size of the string. I've tried with xPath and XML Holder, but still not getting what I want.

  • Length of a string in any known (to me) programming language is trivial. What tools are you limited to? Oct 28 '15 at 14:19
  • If a null tag or empty string is a fail, my answer will work using solely an XPath Assertion. If those conditions are a pass it become slightly more complicated.
    – Paul Muir
    Oct 28 '15 at 14:33
  • I'm using SOAP UI community edition
    – Venom
    Oct 28 '15 at 14:50
  • But what will happen in case string is less than specified? For example, I've tried this expression where string contains 6 characters, but it still matches expression. But if string would contain 8, it would not match. How to do it to be exactly, not more and not less?
    – EugeneM
    May 10 '18 at 8:24

Regexp is your friend


The \w{7,} will match a string with 7 characters. In the Expected Result put "true".

SoapUI Assertions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.