【问题标题】:How to define a method with return type in Groovy script in SoapUI?如何在 SoapUI 的 Groovy 脚本中定义具有返回类型的方法?
【发布时间】:2014-10-12 04:00:09
【问题描述】:

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

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.")

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

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

谢谢,
卡鲁纳加拉潘迪 G

【问题讨论】:

    标签: testing groovy scripting automation soapui


    【解决方案1】:

    你声明了一个方法ReturnCountryValue

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

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

    【讨论】:

      猜你喜欢
      • 2019-02-08
      • 1970-01-01
      • 1970-01-01
      • 2010-12-19
      • 2022-08-18
      • 1970-01-01
      • 1970-01-01
      • 2014-08-14
      • 1970-01-01
      相关资源
      最近更新 更多