We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Is there any way to define a REST parameter that will automatically take like tomorrow's date?
I tried this, but don't know what's really possible or what the syntax would be for more complicated steps:
${=import java.util.Calendar; Calendar now=Calendar.getInstance(); now = now.add(Calendar.DATE, 1); new java.text.SimpleDateFormat("yyyy-MM-dd").format(now.getTime())}
According to the raw value, "now" is null when now.getTime() is called.
Or, this seemed to give the next days date and could be inserted as a REST parameter:
${=def now = new Date();now++;now.format("yy-MM-dd")}This is a working one for soap request, and not tried for REST/Json, would you like to try below one?
${=import java.text.SimpleDateFormat; import java.util.Date;def date=new Date();new SimpleDateFormat("yyyy-MM-dd").format(date)}
Or, this seemed to give the next days date and could be inserted as a REST parameter:
${=def now = new Date();now++;now.format("yy-MM-dd")}Beauty, that does it. I think one key miss with my attempt was the "def" keyword.
Presumably that's a Groovy thing. Of Groovy I know pretty much only what looks exactly like Java :-)
Also suprised that Date++ is even possible!
Finally, is there any way to know which classes don't require full package qualification?
Hi,
There might be something in this previous post to give you what you need, it discusses setting random dates as a parameter:
http://community.smartbear.com/t5/SoapUI-Open-Source/Random-Date-Project-Property/td-p/99993/page/2
For example stuff like the following one-liner:
${=def now = new Date().parse("yy-MM-dd", "14-06-01");now.month = 6 + new Random().nextInt(18);now.format("yy-MM-dd")}
Hope this helps,
Cheers,
Rupert