cancel
Showing results for 
Search instead for 
Did you mean: 

How do I retrieve Raw Request using Context variable in Groovy?

Occasional Contributor

How do I retrieve Raw Request using Context variable in Groovy?

Raw Request.JPGIs there a way I can get the Raw Request contents using Context variable in Groovy? If so, how do I achieve this?

3 REPLIES 3
Contributor

Re: How do I retrieve Raw Request using Context variable in Groovy?

@SriniMarva27, did you try 

 

def TestStep = context.getCurrentStep()
def RestStepName = TestStep.getLabel()

 

context.expand('${'+RestStepName+'#RawRequest}')   

 

or simply

 

context.expand('${MyTestStepName#RawRequest}')   

 

I think this one will give you only payload information.

 

Occasional Contributor

Re: How do I retrieve Raw Request using Context variable in Groovy?

log.info "Request is: "+context.expand('${GetRebates#Request}')
log.info "Raw Request is: "+context.expand('${GetRebates#RawRequest}')

 

Both the lines of code returns me the same content.

Community Hero

Re: How do I retrieve Raw Request using Context variable in Groovy?

if use script assertion for the same request test step then below should do:

log.info context.rawRequest


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors