Ask a Question

How to add Groovy Scripts to data source

SOLVED
cpentecost
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 REPLY 1
jsheph01
Contributor

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 

cancel
Showing results for 
Search instead for 
Did you mean: