cancel
Showing results for 
Search instead for 
Did you mean: 

can not get test step response in groovy

SOLVED
Contributor

can not get test step response in groovy

Hello,

My groovy code is as below.

I can get request, while fail to get response.

The error is

org.apacge.xmlbeans.XmlException: error: unexpected end of file after null
error at line: xx

 

The test step that currentStep points to has been executed and has request/reponse.

if I change  variable

def response=context.expand('${${currentStep.name}#response}')

 

to  the real test step name

def response=context.expand('${Additional#response}') // additional is the test step name

 

The groovy script runs well.

 

My questions

1. Why can I not get the response?

2.  If the test step name has space, like "Additional code", how to make it work in the context.expand. I have tried " "   and '  ', they don't work.

--------------------

 

import com.eviware.soapui.support.XmlHolder
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext
import groovy.sql.Sql
import oracle.jdbc.driver.OracleTypes
import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep

 

def currentStep = testRunner.testCase.getTestStepAt(6)
log.info "currentStep.name: " + currentStep.name

// get the hold of request
def request=context.expand('${${currentStep.name}#request}')
log.info " request: " + request
def xmlreq=new XmlHolder(request)

 

// get the hold of response
def response=context.expand('${${currentStep.name}#response}')
log.info " response: " + response
def xmlres=new XmlHolder(response)      // error occurs here

 

Thanks for your kind help in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Contributor

Re: can not get test step response in groovy

Get my answer from the post.

http://community.smartbear.com/t5/SoapUI-NG/Resolved-Pass-a-variable-into-context-expand-code/td-p/4...

Now variable works well to when I try to get the reponse, while  I still don't know the reason why I need to set different variables to get response/ request  

 

 

 

View solution in original post

2 REPLIES 2
Contributor

Re: can not get test step response in groovy

Can anyone kindly help me?

Contributor

Re: can not get test step response in groovy

Get my answer from the post.

http://community.smartbear.com/t5/SoapUI-NG/Resolved-Pass-a-variable-into-context-expand-code/td-p/4...

Now variable works well to when I try to get the reponse, while  I still don't know the reason why I need to set different variables to get response/ request  

 

 

 

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors