Reputation: 105
I have the below mentioned groovy script in soapui where it
def date=new Date()
use(groovy.time.TimeCategory){ date = date.plus(10.minutes) }
def dateString = date.format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone('UST'))
return dateString
From the request body i am calling this script as shown below,
{
"name": "ABCD",
"tempname": "XYZ",
"starttime": "${StartTime#result}"
}
But it runs fine when i run it from console, but when i use TestRunner script is not getting executed. Kindly let me know how to make a script run from testrunner which is same as running from cmd line.
Upvotes: 1
Views: 392
Reputation: 21349
Never used in the way you mentioned, not sure of the issue. However, you could do something like below overcome the issue.
1.Make below change in the groovy script.
From:
return dateString
To:
context.testCase.setPropertyValue('START_DATE_TIME', dateString)
2.In the Rest request test step, change request
From:
{
"name": "ABCD",
"tempname": "XYZ",
"starttime": "${StartTime#result}"
}
To:
{
"name": "ABCD",
"tempname": "XYZ",
"starttime": "${#TestCase#START_DATE_TIME}"
}
Upvotes: 1