cancel
Showing results for 
Search instead for 
Did you mean: 

Saving REST requests and responses in prettyprint style

Occasional Contributor

Saving REST requests and responses in prettyprint style

Hi,

 

I am maintaining a project that contains a lot of code for (among other things) saving raw requests and responses of REST messages.

 

Since ReadyApi version 2.5.0 there is an option 'Dump file' for each request which will save the response to that request to an allocated place:

https://www.soapui.org/getting-started/working-with-soapui/saving-responses.html

 

An other option (don't know since when) is to run from command line using option -a to export both requests and responses to an allocated map:

https://support.smartbear.com/readyapi/docs/soapui/running/automating/gui.html#reports

Which would look like something like (in Mac form)

/Applications/ReadyAPI-2.6.0.app/Contents/java/app/bin/testrunner.sh -a -f/Users/yournameonyourpc/someoutputmap "-RTestCase Report" /Users/yournameonyourpc/yoursoapuiprojects/yourproject

Both options look promising, because then I can throw away a lot of code, which I no longer have to maintain or edit after that. However, in its raw form both options don't save it in prettyprint style, but in one blurb of content.

 

So my question is: how can I save all requests and responses of a running test in pretty print format, with minimal use of code? 

If not possible: how can I read 'unpretty' REST information from files and save them in pretty print style, the simplest way? (have to be useful for automation)

 

Thank you in advance for your good idea(s), inspiration!

 

Albert

3 REPLIES 3
Community Hero

Re: Saving REST requests and responses in prettyprint style

Please find the below which has sample code to do that.
http://mrhaki.blogspot.com/2011/04/groovy-goodness-build-json-with.html


Regards,
Rao.
Occasional Contributor

Re: Saving REST requests and responses in prettyprint style

I know how to prettyprint in Groovy code, but not how to do this directly when generated by SoapUI (see included links). That was my question.

Regards, Albert

Highlighted
Community Hero

Re: Saving REST requests and responses in prettyprint style

You put another point how read file and do pretty print. That's why posted the link.


Regards,
Rao.
Top Kudoed Authors