Is it possible to transform the following groovy request in a one-line dynamic property? That question is for using the result in a SOAPui request without using a groovy script. Because i have a lot of differents dates to put in my request, and also in my assertions.
import groovy.time.TimeCategory
use (TimeCategory) {
date = new java.text.SimpleDateFormat("yyyy-MM-dd").format(new Date() -5.month)
}
I would like to have a dynamic property that i could, off course, change. For example:
<ech:date1>${Today - 5 month}</ech:date1>
<ech:date2>${Today - 4 month}</ech:date2>
<ech:date3>${Today - 3 week}</ech:date3>
EDIT : More information
Actually, i have a dynamic property that give me today's date, minus or plus x days, that i can put in a xml request in SOAPui:
[Here, it return me today's date plus twenty days]
${=new java.text.SimpleDateFormat("yyyy-MM-dd").format(new Date()+20)}
Sample application:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ech="http://echange.service.open.bodet.com">
<soapenv:Header/>
<soapenv:Body>
<ech:importRequests01>
<ech:Requests01ToImport>
<!--Zero or more repetitions:-->
<ech:Request01>
<ech:requestDate>${=new java.text.SimpleDateFormat("yyyy-MM-dd").format(new Date() +20)}</ech:requestDate>
<!--You may enter ANY elements at this point-->
</ech:Request01>
</ech:Requests01ToImport>
</ech:importRequests01>
</soapenv:Body>
</soapenv:Envelope>
So, i would like to have a same thing, but for asking today's date minus/plus x month...etc.