gpt4 book ai didi

testing - 如何在 SoapUI 的 Groovy 脚本中定义具有返回类型的方法?

转载 作者:行者123 更新时间:2023-11-28 20:20:26 26 4
gpt4 key购买 nike

我需要一个方法来返回一个字符串类型的值给调用者。为此,我编写了以下脚本。

String  getMethodValue = ReturnCountryName("US");

String ReturnCountryValue(String CName)
{
CName = "Mauritius";
return CName;
}

// Assign values to the global properties and call the servive
com.eviware.soapui.SoapUI.globalProperties.setPropertyValue( "CountryName", getMethodValue )

// Call GetCitiesByCountry service to run
def testStep = testRunner.testCase.testSteps['GetCitiesByCountry'];
testStep.run(testRunner,context);

// Message
log.info("Testcase execution is completed successfully.")

我无法找到错误消息的解决方案,如下面的屏幕截图所示。

enter image description here

我应该怎么做才能克服脚本中的这个错误?

谢谢,
Karunagara Pandi G

最佳答案

您声明一个方法 ReturnCountryValue

String ReturnCountryValue(String CName) {
CName = "Mauritius";
return CName;
}

但调用 ReturnCountryName。更改方法名称或调用名称。

关于testing - 如何在 SoapUI 的 Groovy 脚本中定义具有返回类型的方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25376863/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com