Postman-API Testing for beginners

API Example

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 2Execute 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>

Exnewman run https://www.getpostman.com/collections/6bf35945d7f429c32340

Ex: To generate report 

newman run https://www.getpostman.com/collections/6bf35945d7f429c32340 -r html

You May Also Like

About the Author: Sariful I.

Leave a Reply

Your email address will not be published. Required fields are marked *