Newman: How can we get Request data in report ?

Created on 18 Oct 2016  路  26Comments  路  Source: postmanlabs/newman

  1. "newman":"2.1.2" or newman 3.0.1
  2. OS details (type, version, and architecture): windows 10
  3. Command / script used to run Newman:
#newman2
newman -c src\collections\customer-service-BEB-securite.postman_collection.json -d src\fileparameter\customer.json -H results\test\customer.html -O results\log\customer.json

#newman3
newman run src\collections\customer-service-BEB-securite.postman_collection.json -d src\fileparameter\customer.json   -r html,cli,json,junit

Issue

When running newman, in html report we have response data but not request data.

Like you can see in screenshot :


image


How can we log the request data in repport ?
We need it to debug when fails occurs.

Thank you !

Victorien

feature request question reporters tracked

Most helpful comment

The verbose feedback is certainly verbose, but not useful for troubleshooting many issues. It would be great to have Newman log what the Postman console logs.
I'm trying to troubleshoot an auth issue. We run a pre-request script to generate and fetch an auth token from a couple of internal websites. This works fine in Postman but in Newman the response from the first auth request is 400 Bad Request and the second request does not appear to be sent (perhap because the first one failed?).
Is there any way to see what Newman is actually sending in the way of headers and body?

All 26 comments

@vitoo Please use the following command to generate a JSON report, which contains comprehensive information about the collection run:

newman run src\collections\customer-service-BEB-securite.postman_collection.json -d src\fileparameter\customer.json   -r html,cli,json,junit --reporter-json-export verbose-report.json

@kunagpal thanks, we can't show request in html report yet ?

It's a really super verbose report, 12'000 lines !

@vitoo Unfortunately, no, as the HTML report is meant to be a concise summary of collection run information. However, we might consider adding more details to the HTML report format in a future release.

@kunagpal Maybe a html report with a hidden request div, so we can toggle the div to see it ?

@vitoo Precisely, as the report can still be kept concise (at least at first glance), which is the bottom line. Are there any other things that you might want to see in this report?

@kunagpal Maybe an another show/hide div with assertion result colored in green/red ?

Thanks

Yes, differential colour support can (should) be added. We'll keep you posted on it's progress over time. :)

This is not a part of our current roadmap, but has been marked as a feature request and added to our internal tracker. We'll update this thread when any progress occurs on this. :)

We will track these here as well, @kunagpal :)

You could try providing your own HTML reporter template. There's a cli option for the same. Use the current template as reference maybe? We will better document this soon.

@vitoo I added this in my postman collections to show the params:

tests[`[INFO] Request params: ${JSON.stringify(request.data)}`] = true;

https://www.getpostman.com/docs/sandbox

@vitoo Unfortunately, showing request data in the generated report(s) is beyond the scope of the built in Newman reporters. However, you're more than welcome to create your very own custom reporter for the same. For more details, check out https://www.getpostman.com/docs/postman/collection_runs/command_line_integration_with_newman#custom-reporters.

Am not getting Headers and response body in HTML report. could someone help me on this please.

image

@vitoo - could you please advice on above issue please?

Sorry i can't help you with reports, you can try to customize one report

or the https://github.com/postmanlabs/newman/issues/712#issuecomment-257480793 solution

@vitoo - thanks for your reply. am sorry to ask you again. you mentioned as you are getting responses in html report when you reporting this issue (starting of this issue). I tried with that sample code you gave and still am not getting the response in report. please guide me if you have any idea.

I'd just like to add my +1 to this- it would be nice if the stock reporters had the same options for verbosity without having to write custom ones.

+1 for this

I wrote a few lines to get the request/response (header and body) in the default html report
but I had difficulties to get the request headers.

I am getting the response headers in this way:
<tbody>{{#each response.header}}<tr><td>{{this.key}}</td><td>{{this.value}}</td></tr>{{/each}}</tbody>

I tried this:
<tbody>{{#each request.header}}<tr><td>{{this.key}}</td><td>{{this.value}}</td></tr>{{/each}}</tbody>
...but it doesn't work :(

A possible workaround is to get the headers as a string in this way:
{{request.headers}}
Is there a way to access the request header in the same way as the response headers?

@ kunagpal
I am running my collection through newman .I have 9 iterations with the different set of data and based on the data other request is going.I use postman.setNextRequest("nameofrequest").But in my html report showing error ,for each iterations same data is listing.

Can you give solution for this problem?

My Newman report does not generate any data, only the field name, the data is displayed as 0 How to handle

image

@sutianli There are no requests in Requests sections as well. Can you verify collection is selected correctly?
Also, test if you are getting the same result in CLI reporter.

The verbose feedback is certainly verbose, but not useful for troubleshooting many issues. It would be great to have Newman log what the Postman console logs.
I'm trying to troubleshoot an auth issue. We run a pre-request script to generate and fetch an auth token from a couple of internal websites. This works fine in Postman but in Newman the response from the first auth request is 400 Bad Request and the second request does not appear to be sent (perhap because the first one failed?).
Is there any way to see what Newman is actually sending in the way of headers and body?

Bump

I am facing the same issue . My postman request work but newman is giving 400

Was this page helpful?
0 / 5 - 0 ratings