Groovy soapui 中的脚本未从 testrunner 执行

Groovy script in soapui is not getting executed from testrunner

我在 soapui 中有下面提到的 groovy 脚本

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

我从请求正文调用此脚本,如下所示,

{
  "name": "ABCD",
  "tempname": "XYZ",
  "starttime": "${StartTime#result}"
}

但是当我从控制台 运行 时它 运行 没问题,但是当我使用 TestRunner 时脚本没有被执行。 请告诉我如何从 test运行ner 制作脚本 运行,这与从 cmd 行 运行ning 相同。

没有按照你说的方式使用过,不确定问题所在。但是,您可以执行以下操作来解决这个问题。

1.Make 下面更改 groovy 脚本。

发件人:

return dateString

收件人:

context.testCase.setPropertyValue('START_DATE_TIME', dateString)

2.In休息请求测试步骤,更改请求
发件人:

{
  "name": "ABCD",
  "tempname": "XYZ",
  "starttime": "${StartTime#result}"
}

收件人:

{
  "name": "ABCD",
  "tempname": "XYZ",
  "starttime": "${#TestCase#START_DATE_TIME}"
}