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

Highlighted
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
Frequent 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
Highlighted
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,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
New Here?
Join us and watch the welcome video:
Top Kudoed Authors