Forum Discussion

userdanfoss's avatar
userdanfoss
Occasional Contributor
5 years ago

How can i print API response in result doc

Hi,

 

I want to print API response in Result.

i am using script assertion

Please find below code

 

def response = context.expand( '${GetDeviceByEID#Response#$[\'status\']}' )

log.info(response)

 

I want to print this response in result doc.

But its only shown as pass.

Is there any way in ready API so that i can print this values in result?

 

 

 

  • userdanfoss :

     

    If you want to print response in script assertion then you can use

     

    log.info messageExchange.responseContent

     

    don't know about result doc, could you please explain more.

     

    • userdanfoss's avatar
      userdanfoss
      Occasional Contributor

      My question is, 

      I am getting result in console.

      But when we extract the report document then it gives the result as pass or fail only.

      Is there any way so that i can print the result in report as well.

       

       

      • HimanshuTayal's avatar
        HimanshuTayal
        Community Hero

        userdanfoss :

         

        Instead of using log.info you can use assert command it will get printed in report.