Forum Discussion

Narain_padmanab's avatar
16 years ago

Re: How to create datetime string in soapui using groovy

Hi am using Soapui for testing web services. i need to create a customer record with email address and password. in wsdl file ,the operation named create customer record service contains emailid and password, wen i click the run(submit request) button in create customer record in soapui, i should get the emailid  appended with current time of creation and any password. how to do this with groovy?

1 Reply

  • In a groovy script you can use the following to get today's datetime:

      date = new Date()
     
    You can then modify this into the format you desire with something along the lines of:
     
      dateFormat = new java.text.SimpleDateFormat('yyyyMMdd-kkmmss')
      shortDate = dateFormat.format(date)

    You can then use this as required - passing it into a parameter or whatever else you need.
    Hope that helps.
    Geoff