Forum Discussion

Teddy_Liu's avatar
Teddy_Liu
Occasional Contributor
15 years ago

Can I get the header information from rest request using testRunner.testCase?

At first start a rest request, then get the response of this request. In this response, contains a header information "Location" is "http://******/rest/**/12354". 
If this rest test step names "Post",
the I can get this step in Groovy Script:
def aaa = testRunner.testCase.getTestStepByName("Post")
So is it possible to get the header information "Location" from the response of  "Post"?
Thanks for advance!!

Tao

1 Reply

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,

    you can fetch response/request with:

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils.getXmlHolder( "CreateSecurityGroup#Response" )
    log.info ( holder.xml )

    def response = context.testCase.testSteps["CreateSecurityGroup"].properties["Response"]
    log.info( response.value )


    also, check this: http://www.soapui.org/userguide/requests.html

    robert