Reputation: 5681
I try to generate load test from my testcase in SoapUI
. It has a lot of test steps, from which the first 10 covers the login process. LoadTest
stops in a Groovy
script, which should get parameter values from the previous test step's output. It is working correctly, when it is executed directly, but gives error, when it is executed as a 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
script which causes error above:
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);
Upvotes: 5
Views: 165
Reputation: 3016
Your problem in this string:
String rawData = new String(tc1.testRequest.response.rawResponseData)
tc1.testRequest.response.rawResponseData is null
so to prevent exception you can change this string to:
String rawData = tc1.testRequest.response.rawResponseData?.toString()
which is null safe
Upvotes: 2