groovy - SoapUI LoadTest 执行失败

标签 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);

最佳答案

您在此字符串中的问题:

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

tc1.testRequest.response.rawResponseData 一片空白

所以为了防止异常,您可以将此字符串更改为:
String rawData = tc1.testRequest.response.rawResponseData?.toString()

这是空安全的

关于groovy - SoapUI LoadTest 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49624563/

相关文章:

web-services - soapUI 结合了更多模拟服务

web-services - Soa 网络测试自动化

c# - 如何在 VS WebTest 中发布 Json 对象?

Groovy - 编写类似闭包的 Unix grep 的更短方法

java - 在 gradle 脚本中通过 AntBuilder 提供主类属性

groovy - 有没有其他 Grash 之类的增强型 Groovy shell?

groovy - Elasticsearch-在function_score和访问字段有效负载内使用groovy脚本

xml - 如何解释 WSDL 来手动创建 XML SOAP 请求?

load-testing - Web容量分析工具(WCAT)教程

http-headers - 我可以使用 Siege 设置多个标题吗?