简体   繁体   English

Groovy脚本数组中的错误

[英]Error in groovy script array

In groovy script, I am setting the property value from an array as follows: 在groovy脚本中,我从数组中设置属性值,如下所示:

def CustomerNumber = [100944050,100944193,100946438];

CustomerNumber.each(){
    testRunner.testCase.setPropertyValue("customerNumber",it);
}

I am getting the error: 我收到错误消息:

groovy.lang.MissingMethodException: No signature of method: 
com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.setPropertyValue() is applicable for argument types: (java.lang.String, java.lang.Integer) values: {"customerNumber", 100944050}

SoapUI's WsdlTestCase inherits setPropertyValue method : SoapUI的WsdlTestCase继承了setPropertyValue方法

public void setPropertyValue(String name, String value) Specified by: setPropertyValue in interface TestPropertyHolder

You need to pass two strings to that method. 您需要将两个字符串传递给该方法。

According to the JavaDocs , the setPropertyValue method takes two String arguments. 根据JavaDocssetPropertyValue方法采用两个String参数。 So you need to convert your customer number integer to a String: 因此,您需要将客户编号整数转换为字符串:

def customerNumber = [100944050,100944193,100946438]

customerNumber.each {
    testRunner.testCase.setPropertyValue("customerNumber", it as String)
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM