cancel
Showing results for 
Search instead for 
Did you mean: 

How to add Groovy Scripts to data source

SOLVED
Occasional Contributor

How to add Groovy Scripts to data source

Hello Community

 

I am trying to add a script that will allow me to choose tomorrow's date into a data source property in SoapUI pro.

The Call fails if we use a date int he past but we don't want to continue to have to update the tests before each run.

 

Any help would be great.

 

Thanks 

 

C

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Contributor

Re: How to add Groovy Scripts to data source

You can place this in a properties step or use it in a request. It will return tomorrows date in YYYY-MM-dd HH:mm format. 

${=import java.text.SimpleDateFormat ; new SimpleDateFormat("YYYY-MM-dd HH:mm").format(new Date()+1)}

If you would like to use a different date format this doc should be helpful.

https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html 

View solution in original post

1 REPLY 1
Highlighted
Contributor

Re: How to add Groovy Scripts to data source

You can place this in a properties step or use it in a request. It will return tomorrows date in YYYY-MM-dd HH:mm format. 

${=import java.text.SimpleDateFormat ; new SimpleDateFormat("YYYY-MM-dd HH:mm").format(new Date()+1)}

If you would like to use a different date format this doc should be helpful.

https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html 

View solution in original post