cancel
Showing results for 
Search instead for 
Did you mean: 

TestCaseRunner not passing groovy step result

Highlighted
Occasional Contributor

TestCaseRunner not passing groovy step result

Hi,

I am using SOAPUI 5.3

Build a SOAUI Test Suite with one Grrovy step to generate uuid.

String uuid = org.apache.commons.lang.RandomStringUtils.randomNumeric(2)

 

Now I am pssing the step result value to REST Step Request.

${result}

 

It works fine when runs in SOAPUI Tool.

But when I run SOAPUI from java 1.8 using TestCaseRunner the groovy result value is not being passed to REST Step Request.

 

3 REPLIES
Community Leader

Re: TestCaseRunner not passing groovy step result

Try using your context:

context["uuid"] = org.apache.commons.lang.RandomStringUtils.randomNumeric(2)

 

{

  id: "${uuid}"

  // more json...

}

 

Or even do away with the script altogether and write Groovy inline:

 

 

{

  id: "${=org.apache.commons.lang.RandomStringUtils.randomNumeric(2)}"

  // more json...

}
Occasional Contributor

Re: TestCaseRunner not passing groovy step result

Hi,

 

I updated groovy script as 

context["uuid"] = org.apache.commons.lang.RandomStringUtils.randomNumeric(2);

 

Pass the value in another Step as

"email": "test0612201700${uuid}@csp.com",

 

This runs successfully in SOAPUI Test Case.

 

But when I run SOAPUI from Java script using below TestCaseRunner the value is not being passed due to which error in the Response.

TestCaseRunner runner = testCase.run(new PropertiesMap(), false);

 

Am I missing something?

 

 

Occasional Contributor

Re: TestCaseRunner not passing groovy step result

It got solved by using 

SoapUITestCaseRunner runner = new SoapUITestCaseRunner(); 

instead of 

TestCaseRunner runner = testCase.run(new PropertiesMap(), false);

Watch a new Video
Top Kudoed Authors