Forum Discussion

juanteit's avatar
juanteit
New Contributor
17 years ago

Saving raw xml

I have a request with variables:

 

 
     
       
       
...

In the raw tab of the test step, I have:


 

 
     
       
       
...


I want to put into a file the raw version with groovy. How can I do that? I tried:

def response = context.testCase.testSteps["bookReservation - Requete base 2"].properties
log.info (response["Request"].value)

It gives the xml tab version.

I also tried:
holderReq = groovyUtils.getXmlHolder (requestname + "#Request")
fileReq = new File( context.getProperty("test_folder") + "\\" + requestname + "-Req.xml" )
writer = fileReq.newWriter()
writer.writeLine(holderReq.xml)
writer.close()

It gives the xml tab version.

1 Reply

  • juanteit's avatar
    juanteit
    New Contributor
    I found an answer, so I let you know:

    To save the raw data, I access to my xml during test case execution using:

    testRunner.getResults().getRequestContent()
    testRunner.getResults().getResponseContent()


    i is an integer, that may be obtained by:
    i = testRunner.testCase.getTestStepIndexByName("My Test Step")

    Hope it helps anybody...