Postman newman html report publishing

Postman team

We are using postman(6.6.1) newman team license. We have a Jenkins job up and running to execute collections using newman for our services testing.

I am looking for a way to publish simple services status like (200 OK) in a graphical form into a webpage. If I execute my collection (with set of GET /POST calls to ping the server) it should generate a page. This status page should be accessible by our team.

Options explored:

  1. Tried generating a HTML report. It is generating the report in the same directory where newman is executed. How to publish just the green and red status of the integration services status in a web page.

With the above approach one has to go to jenkins server to access the results report. I do not want details like response or headers. We would like to show the service name and ping status in a web page. It should show just red or green some thing like this.

  1. I also came across data dog integration. If I integrate postman with datadog can I accomplish the above requirement?

  2. Is there a slack channel to ask questions about newman/postman? Pl share the name of the slack channel and how to get access to it.

I continued this conversation in a private message but I wanted to add part/general gist of the messages here too for other people…

"I was messing for a few minutes and created this template, based on an example collection that I run locally when testing. The Status column would be a green box and a tick if the status code is 200, or red box and a cross for anything else.

You can get the sample test.hbs file from here:

Copy the file locally and use the --reporter-htmlextra-template flag in the cli to reference the file location.

Example Newman command:

newman run collection.json -e environment.json -r htmlextra --reporter-htmlextra-export test.html --reporter-htmlextra-template test.hbs

This isn’t a perfect solution but it’s hopefully going to show you something simple that can be done."

2 Likes

Hi , could you please explain this command? I would like to create one but with own requirement.
Thanks

Hey @tejaswinipatel3,

This is the command that allows you to run Collections via Newman. The most basic command would be:

newman run {your collection filename}.json

This would run your collection and output the details of the run on the CLI, this is the default reporter. Although this is using a static exported collection file, you can also use a URL link to the collection file. This can be via a public shared link created within the app or a link to the collection via the Postman API.

The command that I used is using the -e flag to bring in an environment file, which would contain certain variables being referenced in the collection or act as a store for values being set during the run.


-r htmlextra --reporter-htmlextra-export test.html --reporter-htmlextra-template test.hbs

This part of the command is using the -r flag (shorthand for --reporters) to tell Newman to use the htmlextra reporter.

The --reporter-htmlextra-export is setting a file path location for the final report to be saved. If this is not used, the final output will be placed into the /newman directory.

Finally, the --reporter-htmlextra-template flag is telling the htmlextra reporter to use a custom template for this run, if this flag was not included in the command, the default template would be used instead.

More information about these flags and the other flags for Newman and the htmlextra reporter can be found here:

Thank you so much @danny-d. I got it and well explained answer. I appreciate your help.

I can run this command from CLI and getting expected output with reports, but when I use the same command on Jenkins to run collection and generate reports, It is not working. I am curious, how it could be possible that same command is not working for Jenkins? How can I generate reports on Jenkins using postman collection?
Also, Jenkins log shows that build, create time and result time is same meaning it doesn’t take even 10 Sec to run collection. Looking for suggestions and understanding.

You’re welcome.

I don’t use Jenkins very often and only have limited knowledge about using Newman on there.

Luckily, I know a guy (@vdespa) who has a selection of awesome Postman videos on his YouTube channel.

Here’s the one he has for running Newman on Jenkins:

1 Like

Sounds awesome!! Thanks .

Hi , I want to create similar templates but with different data like.

Columns -
Folder name , Request name , All Assertion’s , Status.

As such I have created basic structure but not able to put values in it.

Can you please help ?

The data is going to live in lots of different parts of executions - it’s not really a case of getting it in a simpe way because it all depends on the structure the Newman summary object.

I would try to understand the references to each part before trying to add it all to a template.

I wrote this a while back:

It contains a simple version of what Newman returns so hopefully that will allow you to understand it a bit more.

Thanks for quick reply with supporting documents.

I’ll try to write the new templates with details provided.

Cheers…