1
我尝试使用groovy脚本和soapUI自动化测试用例。在groovy context.expand表达式中使用变量
发送肥皂请求,我收到了一个包含公司列表的响应。 我想要做的是验证上市公司的名称。 响应数组的大小不固定。
所以,我想下面的脚本只是开始,但我卡住了..
def count = context.expand('${Properties#count}')
count = count.toInteger()
def i = 0
while (i<count)
(
def response = context.expand('${getCompanyList#Response#//multiRef['+i+']/@id}')
log.info(response)
i=İ+1
)
我得到
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script12.groovy: 6: unexpected token: def @ line 6, column 1. def response = context.expand('${getCompanyList#Response#//multiRef['+i+']/@id}')^org.codehaus.groovy.syntax.SyntaxException: unexpected token: def @ line 6, column 1. at
我应该以某种方式放在“响应”定义“我”。 。