Run collection(suite)/Requests through command line (CL)
Prerequisite:
- Download & Install node.js (npm): node –version; npm -v
- Install newman through cmd (user/sarif): npm install -g newman
- To Generate html reporter install: npm install newman-reporter-html
- Export & save the collection want to run through command prompt
2 ways to run Collection through CL :
Method 1: Run through local cmd prompt
-Type & execute in cmd (open from the local folder) :
newman run <path of the exported collection file.json>
-Type & execute to generate html reporter:
newman run <path of the exported collection file.json> -r html
Method 2: Execute collection through remotely using share link
-Click on (…) dots the collection want to run >share >Via API link
-Copy the link (ex): https://www.getpostman.com/collections/6bf35945d7f429c32340
-Type & execute in cmd (open from the local folder) : newman run <link of the collection’s api>
Ex: newman run https://www.getpostman.com/collections/6bf35945d7f429c32340
Ex: To generate report
newman run https://www.getpostman.com/collections/6bf35945d7f429c32340 -r html