Generate Postman Report in XML and HTML format

Ningrum
3 min readOct 7, 2020

--

Postman is the collaboration platform for API development. You can use postman to automate your API test.

Postman contains a collection runner. In a collection there is a group of requests.

After you run a collection, you need generate test report. You can generate it using simple CLI command below:

  1. XML Report using — reporter-junit
  2. HTML Report using — reporter-html
  3. HTML Report using — reporter-html-extra

Before generate report, you have to prepare collection JSON file and environment JSON file if there is dependency between them. (I will explain how to export collection to JSON file in a separate post)

  1. XML Report using — reporter-junit

Open command prompt and type command below:

newman run C:\Users\<myself>\Desktop\Tests.postman_collection.json -e C:\Users\<myself>\Desktop\Tests.postman_environment.json - reporters cli,json,junit - reporter-junit-export C:\Users\<myself>\Desktop\my_report_name.xml
generated postman XML report using newman command
view of XML Report

If you store variable in collection or request directly (no variable in environment), you don’t need ‘-e’. The CLI command will be:

newman run C:\Users\<myself>\Desktop\Tests.postman_collection.json - reporters cli,json,junit - reporter-junit-export C:\Users\<myself>\Desktop\my_report_name.xml

2. HTML Report using — reporter-html

Open command prompt and type command below:

newman run C:\Users\<myself>\Desktop\Tests.postman_collection.json -e C:\Users\<myself>\Desktop\Tests.postman_environment.json - reporters cli,html,json,junit - reporter-html-export C:\Users\<myself>\Desktop\my_report_name.html
generated postman HTML report using newman command
view of postman HTML report

You can generate xml and html report in once with this CLI command:

newman run C:\Users\<myself>\Desktop\Tests.postman_collection.json -e C:\Users\<myself>\Desktop\Tests.postman_environment.json - reporters cli,html,json,junit - reporter-junit-export C:\Users\<myself>\Desktop\my_report_name.xml - reporter-html-export C:\Users\<myself>\Desktop\my_report_name.html - disable-unicode
generated postman XML and HTML report using newman command

I use ‘— disable-unicode’ to force the unicode disable option and all symbols in the output will be replaced by their plain text equivalents.

. HTML Report using — reporter-html-extra

Open command prompt and type command below:

newman run C:\Users\<myself>\Desktop\Tests.postman_collection.json -e C:\Users\<myself>\Desktop\Tests.postman_environment.json -r htmlextra - reporter-htmlextra-export C:\Users\<myself>\Desktop\my_report_name.html
generated postman HTML report using newman command
view of postman — reporter-htmlextra report

Thanks for reading.

--

--

Ningrum
Ningrum

No responses yet