Forum Discussion

fazlook's avatar
fazlook
Frequent Contributor
8 years ago
Solved

Regular expression XML tags in Contains Assertion

Hi guys,   I am trying to match a date format with contains assertion in SoapUI but it does not work for me.   Date format I want to match is: <InsertDate>2017-01-03T17:48:45</InsertDate>   I t...
  • nmrao's avatar
    8 years ago

    There is a tricky part using Contains Assertion in association with Regex. i.e., the regex that user provides is matched against the entire content of the response. Hence you see the assertion failed.

     

    If I would have to do it, I prefer to do in groovy, and here is the one:

     

    https://github.com/nmrao/groovyScripts/blob/master/regex/dateSample.groovy

     

    If you go for Script Assertion, then remove the xml, instead use context.response in the above script.