Forum Discussion

minu_cet's avatar
minu_cet
Occasional Contributor
7 years ago

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

  • JHunt's avatar
    JHunt
    Community Hero

    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...
    
    }
    • minu_cet's avatar
      minu_cet
      Occasional Contributor

      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?

       

       

      • minu_cet's avatar
        minu_cet
        Occasional Contributor

        It got solved by using 

        SoapUITestCaseRunner runner = new SoapUITestCaseRunner(); 

        instead of 

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