Eviware Forum

soapUI => soapUI => Topic started by: srinivas das l on July 28, 2008, 12:28:25 pm



Title: Create TestReport from the request and response in soupUI
Post by: srinivas das l on July 28, 2008, 12:28:25 pm
Can any one tell me how to save Request and Response in a doc file .
what is the groovy script for that??


Title: Re: Create TestReport from the request and response in soupUI
Post by: omatzura on August 04, 2008, 12:34:44 pm
Hi!

sure.. try the following after you have received a response:

Code:
def testRequest = testRunner.testCase.testSteps["Request 1"].testRequest
def out = new FileWriter( "out.txt" )

out.println( testRequest.requestContent )
out.println( testRequest.response.contentAsString )

Hope this helps!

regards,

/Ole
eviware.com


Title: Re: Create TestReport from the request and response in soupUI
Post by: srinivas das l on August 05, 2008, 04:48:57 am
Thanx for the script.IT's really useful...but i want that to be done using a single script..like we can add that script to a testsuite and whenever we run that suite....all the Request and Response get printed in a text file with a single click...


Title: Re: Create TestReport from the request and response in soupUI
Post by: omatzura on August 05, 2008, 07:28:30 am
Hi!

well, that's not as easy, but still possible.. you would have to create a TestRunListener extension that intercepts all teststep executions, checks that the result is a WsdlTestRequestStepResult and logs the request/response accordingly. If you don't want this to apply to all teststeps run in soapUI, you could check for a TestCase property in the listener to enable/disable logging.. have a look at http://www.soapui.org/architecture/extensions.html to get going with soapUI extensions..

makes sense?

regards!

/Ole
eviware.com


Title: Re: Create TestReport from the request and response in soupUI
Post by: BhuvanShanmugam on August 07, 2008, 11:19:44 am
Srinivas,

Could you please let me know how you got on with ole's suggestion.

I am interested in having this logging feature at testsuite/project level as well.

Thanks,
Bhuvan.