SoapUI - Dynamic Properties - Getting Current Time in DateTime Format

SoapUI satisfies the need of testing service oriented applications with test suites that depends on client scenarios. SoapUI enhances its test suite facility with Groovy scripts to create dynamic properties that helps functional testing. The example in soapUI website demonstrates how to retrieve current date in xsd:date format (yyyy-MM-dd). I am not very keen on Groovy but after a bit effort, i implemented this code snippet that returns the current date in xsd:dateTime format. I hope it helps...

def dateTimeFormat = "yyyy-MM-dd'T'hh:mm:ss'Z'"
def timeZone = TimeZone.getTimeZone("Etc/GMT")
def dateTimeFormatter = new java.text.SimpleDateFormat(dateTimeFormat)
return dateTimeFormatter.format(new java.util.Date())

SoapUI DataGen Test Suite Facility
SoapUI DataGen Test Suite Facility
SoapUI is not only sending-receiving soap messages, great testing environment tools and Groovy script support makes it valueble.Do not commit any implementation without finding out in soapUI. As old saying: YOU SHOULDN'T BUILD A TOOL WHEN YOU COULD PURCHASE ONE.


Popular posts from this blog

SoapUI 4.5.0 Project XML File Encoding Problem

COMRESET failed (errno=-32)