Get all Console output to CSV

Hi!
I need document all the request and responses that I’m testing. Currently what I do is copy and paste to Excel every request and its response from the Postman Console, but it’s very hard to do every day with several requests. I tried by newman but I couldn’t find a way to get the complete and real request/responses that Postman runs. How can export the Console output data? from Postman, from Newman or from some log, both can be useful to avoid copy&paste every time.
Thanks!

Hey @sebadiaz.working,

Would this reporter be of use to you? It will create a report with the information you require.

Thanks @danny-dainton. It isn’t that I wanted but it would be very useful for me in other aspects. Currently, I don’t see any difference when I add " --reporter-htmlextra-logs" after the “-r htmlextra”. I mean, the html report as the same size and the same details. Any suggestion?

What versions of the reporter and Newman do you have?

If you have console logs in your collection and you use that flag they should be shown on the report.

Mmm it’s extrange. There isn’t difference with that flag. Newman is 4.5.5 and newman-reporter-htmlextra is 1.9.2.

Without knowing more about the Collection and what you’re currently looking at it’s going to be difficult to offer any advice here.

If you have console.log() statements in your requests and you enable the CLI flag, that’s all you need. You can open an issue on the repo if you believe there is an issue with the reporter - I would be able to this investigate further.

Hi @danny-dainton, sorry for the delay. I’ve come back to this last week and I’ve analyzed it again. I’ve done work that you explained to me.

Retrying, I see the “Console Logs” into the HTML report. As well, I’ve used the CSV output (-r cli,csv). Both very good things, thanks!

Now, going to the origin of this topic, the solution for my problem would to add two new columns into that csv report.

These columns should be: request and response for each request test (in the raw format of the Postman Console), for example like this:

Request:

GET /get HTTP/1.1
User-Agent: PostmanRuntime/7.22.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 6f09124d-24fc-4b06-8e6e-8cd5a67a83e2
Host: postman-echo.com
Accept-Encoding: gzip, deflate, br
Cookie: sails.sid=s%3A25t6janhwVSUNcE68vGBB5PmhH1dWQ9f.M35ow7tfBCFRnsLJhly6eEnkgrtdcbhyo1rZM4bLhsU
Connection: keep-alive

Response:

HTTP/1.1 200 OK
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Thu, 05 Mar 2020 00:02:36 GMT
ETag: W/"19d-iqsCv8nXWXcWnlj96v/y/Z3W7qc"
Server: nginx
set-cookie: sails.sid=s%3AJ0H1BmT2KDXNW-C6qy0h5iyiN-PA9Lql.vRynTsNrd7v3adQuAWsFvcbAKZ4Yv4CBamtPaezmbOU; Path=/; HttpOnly
Vary: Accept-Encoding
Content-Length: 317
Connection: keep-alive
{"args":{},"headers":{"x-forwarded-proto":"https","host":"postman-echo.com","accept":"*/*","accept-encoding":"gzip, deflate, br","cache-control":"no-cache","cookie":"sails.sid=s%3A25t6janhwVSUNcE68vGBB5PmhH1dWQ9f.M35ow7tfBCFRnsLJhly6eEnkgrtdcbhyo1rZM4bLhsU","postman-token":"6f09124d-24fc-4b06-8e6e-8cd5a67a83e2","user-agent":"PostmanRuntime/7.22.0","x-forwarded-port":"443"},"url":"https://postman-echo.com/get"}

I’ve read the newman documentation but I didn’t find this data. Do you any recommendation to get these data into a CSV file?

Thank in advance.

Hey @sebadiaz.working

This is something that has been mentioned before in the past and an issue was opened for it on the CSV’s reporters repo:

I don’t think it’s an easy and straight forward thing to add into the CSV reports and as @matt mentioned in the thread on that issue, as to why it wasn’t there from the start:

I purposefully left out the response body when putting this together as I felt that the CSV format didn’t best support either a large or complex response body and that it is better suited to brevity and reporting more ‘fixed’ values.

Thanks @danny-dainton. The @matt’s comment sounds logical. I’ve seen very big responses that can’t be useful into an CSV. Maybe that can be considered using an additional flag for ask it? I mean, like an extended CSV reporting. Maybe it can be useful for more people. In my case we use it to document all the request/responses for each API we test. Currently, we should copy & paste from Postman Console into an Excel.
Meanwhile, we’re making a new reporter that gets request/responses during Newman execution and send them to a stdout. Thanks again for your comments!

Hi @sebadiaz.working , pls do share what csv reporting are you using.

If possible how can i use specific value around 1000 property values from nested array json response in postman and capture in csv ? using console.log(path[0].ofpropery.innestearray)

Hi @gpub1, as I needed to get all the responses to make reports, finally, a partner has developed a new newman reporter. It is like a “plugin” for newman command that show by stdout (running from console) the request and the response. We send this output to a file to be processed with a python script that insert every part of that output into an array. That last part is easiest, the important solution was the mentioned reporter. If you want you can download it from here:

Check the main Readme.md to know how to install and use it. Take in mind that this was developed only for our internal, so we can’t ensure that this will work fine for any case. You can try it and if it would be useful for you, good!
Good luck!

1 Like

hey thanks!!

though i’ve got my stuff sorted out from newman reportlibrary

1 Like

Unable to print console logs into csv, tried custom library also. nothing works
not for the reporter part as used in newman command.

Just need to print the console logs for Prod that need to be used into DB check for automating purpose. Since copying manually takes too much time, any help would be great
Saving the console logs into CSV file

image