Forum Discussion
nmrao
6 years agoCommunity Hero
This is not only nice question but also nice feature as that will help to avoid another groovy script test step for small tasks.
However, there is a limitation that there can't have nested "${..}" in the expression.
Date is the most commonly used dynamic value for both SOAP or REST requests apart from generating value for unique field such as ID.
If unique id is needed as value in the request payload,
Number type
${= System.currentTimeMillis()}
String type with unique
${= UUID.randomUUID()}
For date,
Below sample with future formatted date with time zone
WIth JDK 8
${= java.time.ZonedDateTime.now(java.time.ZoneId.of("GMT")).plusMinutes(40).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))}
The above are oneliners, so no need to create separate script test step, just embed the code snippet in the request step directly.
Note that user have to use them along with package as shown in the date example.