SoapUI LoadTest执行失败

时间:2018-04-03 07:29:37

标签: groovy soapui load-testing

我尝试在SoapUI中从我的测试用例生成负载测试。它有很多测试步骤,前10个包含登录过程。 LoadTest停在Groovy脚本中,该脚本应从先前测试步骤的输出中获取参数值。它是直接执行时正常工作,但在以LoadTest执行时会出错:

groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.String# . Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class [B] [class [C] [class java.lang.String] groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.String# . Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class [B] [class [C] [class java.lang.String] error at line: 5
导致上述错误的

Groovy脚本:

def tc1 = testRunner.testCase.getTestStepAt(context.currentStepIndex-1);
String rawData = new String(tc1.testRequest.response.rawResponseData);
Reger reger = new Reger(rawData); 

String myvar1 = reger.getNthMatch(/<myregex>/, 0);

1 个答案:

答案 0 :(得分:2)

您在此字符串中的问题:

String rawData = new String(tc1.testRequest.response.rawResponseData)

tc1.testRequest.response.rawResponseData 为空

因此,为了防止异常,您可以将此字符串更改为:

String rawData = tc1.testRequest.response.rawResponseData?.toString()

这是空的安全