cancel
Showing results for 
Search instead for 
Did you mean: 

I need to get REST step (the best would be failed one) and log its request

tos
Occasional Visitor

I need to get REST step (the best would be failed one) and log its request

Hi,

The test cases consists of REST  type steps and groovy scripts. There is a need to log failed REST request url and body

sent. 

 

Is there any way, for example in Tear Down script to log failed REST step endpoint url and request json body which was sent?

 

2 REPLIES 2
Highlighted
Contributor

Re: I need to get REST step (the best would be failed one) and log its request

An example to look at:

 

http://onetestsolution.com/blog/reading-json-request-and-response-in-soapui-using-groovy-scripting/

 

If your url endpoint was a variable, you could use that in your log because you know what it it.

 

def ep = testRunner.testCase.testSteps["Request Step"].testRequest.endpoint

JamesK
Community Leader

Re: I need to get REST step (the best would be failed one) and log its request

Hi @tos ,

 

Yes sure you can achieve this by writing your own custom groovy code to capute both endpoint with request and response.

 

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
New Here?
Join us and watch the welcome video:
Watch the New Interview
7Mistakes
Join the exciting event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win