Print API response in "Test results" tab in Postman



  • I'm using Postman to automate an API using Newman.

    But the response body of the API call is not showing in the Postman "Test results" tab.

    var body = JSON.parse(responseBody); 
    tests["Response Body ", body] = true; 
    

    I have tried the above code,but even after successful API call the response is not printing in the "Test results" tab.

    The output of above is showing as,
    PASS [object Object]

    Any suggestions to print the API response will be of great help. Thanks in advance!



  • Please try without parsing, Like below

    var body = JSON.parse(responseBody); 
    var content = responseBody;
    tests["Response Body"+content]= body.length != 0
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2