Forum Discussion

stenofski's avatar
stenofski
Occasional Contributor
12 years ago

SoapUI 4.6.3 Assertion Contains with Regex

Hello Everybody,

I´ve read a couple of topics in this board and read over several webpages via google but I can’t find a simple solution for my issue. Basically I’m just searching for a timestamp which is frequently updating values via regex in a WS response and it matches in several online and offline regex testers but not in SoapUI. Finger is crossed, that somebody here could help me in this point and finds a simple way for others who are also struggle in this point.

The value im looking for is this one
<DatumKuendigung>2014-02-23T12:49:51.000+01:00</DatumKuendigung>

My regex Im using looks like that
(?s).*\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{2}:\d{2}.*
or
(?s).*<DatumKuendigung>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{2}:\d{2}.<DatumKuendigung>*
or
(?s).*[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\+[0-9]{2}:[0-9]{2}.*

The error message I always get is “Contains - Failed -> Missing Token [“my regex”] in Response"

Please let me know if you have any clue how to find this string.

          ...        
<Stadt>Berlin WS</Stadt>
<Land>Deutschland</Land>
</KontoinhaberAdresse>
<NachfolgeMandatId>-1</NachfolgeMandatId>
<DatumStatusaenderung>2014-01-15T12:53:46.262+01:00</DatumStatusaenderung>
<DatumLetzteFaelligkeit>2014-01-15T12:53:46.262+01:00</DatumLetzteFaelligkeit>
<DatumKuendigung>2014-02-23T12:49:51.000+01:00</DatumKuendigung>
<DatumLetzteAenderung>2014-01-15T12:58:28.016+01:00</DatumLetzteAenderung>
<DatumErstellung>2014-01-15T12:53:46.296+01:00</DatumErstellung>
<DatumNachfolgemandat>2014-01-15T12:53:46.262+01:00</DatumNachfolgemandat>
<DatumLetzteNutzung>2014-01-15T12:53:46.262+01:00</DatumLetzteNutzung>
</Mandat>
</Result>
</ns1:AendernSEPAMandatResponse>
</soap:Body>
</soap:Envelope>

11 Replies

  • stenofski's avatar
    stenofski
    Occasional Contributor
    For those who are interested, the solution I use now.
    She is not beautiful and not what I was looking for, but does his job.

    If I need to check a timestamp, I set by groovy script the corresponding value in a test case property and check by XPath and this variable

    Condition
    The time stamp is for example created at the beginning of the test and is later tested in another test step so that I could transfer it via property transfer step

    Nachteil
    Mehr steps und testcase properties notwendig