I am new to Postman and API testing world. I was able to create some basic tests and my team is looking for how long each api takes to respond. They want me to export the results to csv file so they can sort it by the response time to see which ones are taking the longest to respond. How can I easily fulfill that requirement using Postman? Question 1: Is there any way to automatically write the test results at the end of the test run to a csv file using Javascript in the Collection Test?
Question 2: We are planning to integrate the tests with the builds. That means when somebody pushes a build, these tests will be run first using Newman. Not sure if the test results (in JSon format) will be automatically saved somewhere. If so can we do the conversion Json to CSV using New man after the test?
Following information is needed in the csv file - Test name, request URL, pass/fail with the response time.
The idea here is that Newman provides an event emitter interface, which allows users to write highly complex handlers to account for virtually any use case. In this case, you can use the test event (see the links above for more context), which will let you handle test data in real time as the collection runs.
Thanks @kunagpal ,
Itโs help me a lot. Right now, I can export results with some types such as HTML, XML. I also can customer HTML template to render as format I want. Here are some notes of mine:
+ Syntax:
newman run [FileNameJSon] -e [Environment] --reporters cli,[Support_Type] --reporter-[Support_Type]-export [Output_File].[Support_Type] Example:
newman run 1_Automated_APIs.postman_collection.json -e SIT.postman_environment.json --reporters cli,html --reporter-htmlโexport outputfileHTML.xml + Customize template HTML
newman run [FileNameJSon] -e [Environment] --reporters cli,html --reporter-html-template template-default.hbs --reporter-html-export [Output_File].html Example:
newman run 1_Automated_APIs.postman_collection.json -e SIT.postman_environment.json --reporters cli,html --reporter-html-template template-default.hbs --reporter-html-export outputfilehtml1.html
Your questions are very interesting but hard to answer and you did not give very much context. I would advise that you create two separate questions, in case they donโt directly relate to the question being asked here.