cancel
Showing results for 
Search instead for 
Did you mean: 

Command line testRunner.testCase.getTestStepByName( "Request 1" ); does not work

Highlighted
Contributor

Command line testRunner.testCase.getTestStepByName( "Request 1" ); does not work

Hi I am running below statement in my groovy script and "request" variable is always null. It works when I execute in UI but not in commandline. I am using 2.5.1 version.
Both the groovy step and HTTP request step are in same testsuite and testcase. Please let me know if there is anything missing.



def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)


def request = testRunner.testCase.getTestStepByName( "HTTP_Test_Request" );
log.info("*********request values::::"+request)

def property = request.getProperty("request");
def records  = new groovy.util.XmlParser(false,false).parseText(property.value);
Thanks
Shiva
2 REPLIES 2

Re: Command line testRunner.testCase.getTestStepByName( "Request 1" ); does not

Hi Shiva,


You code looks OK. The snippet:

def request = testRunner.testCase.getTestStepByName( "HTTP_Test_Request" );
log.info("*********request values::::"+request)

should actually work from both UI and command-line (e.g. when testrunner.sh or testrunner.bat is invoked). It works on my machine.

Make sure you've entered the test step name correctly. You can, for example, click on a test step you want to access, hit F2 (as if to rename it). copy the name in clipboard and paste it right into your Groovy script.

If you're still getting a null, then download the latest nightly build and try the same script with it.


Cheers!
/Nenad Nikolic a.k.a. Shonzilla

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️Please mark my answer as a solution if it was helpful
Highlighted
Contributor

Re: Command line testRunner.testCase.getTestStepByName( "Request 1" ); does not work

Somehow my classpath was referring to soapui2.0.2 instead of 2.5. With 2.5 it works fine.
Thanks
New Here?
Join us and watch the welcome video:
Top Kudoed Authors