- Postman Tutorial
- Postman - Home
- Postman - Introduction
- Postman - Environment Setup
- Postman - Environment Variables
- Postman - Authorization
- Postman - Workflows
- Postman - GET Requests
- Postman - POST Requests
- Postman - PUT Requests
- Postman - DELETE Requests
- Postman - Create Tests for CRUD
- Postman - Create Collections
- Postman - Parameterize Requests
- Postman - Collection Runner
- Postman - Assertion
- Postman - Mock Server
- Postman - Cookies
- Postman - Sessions
- Postman - Newman Overview
- Postman - Run Collections using Newman
- Postman - OAuth 2.0 Authorization
- Postman Useful Resources
- Postman - Quick Guide
- Postman - Useful Resources
- Postman - Discussion
Postman - Run Collections using Newman
To run Collections using Newman, we have to first launch the Postman application and click on the three dots available beside the Collection name. The details on how to create a Collection are discussed in detail in the Chapter − Postman Create Collections.
Follow the steps given below to run collections using Newman −
Step 1 − Click on Export.
Step 2 − Select the option Collection v2.1(recommended) from the EXPORT COLLECTION pop-up. Click on Export.
Step 3 − Choose a location and then click on Save.
Step 4 − Next, we shall export the Environment. Click on the eye icon to the right of the No Environment dropdown.
Step 5 − Click on the Edit link in the Globals section.
Step 6 − MANAGE ENVIRONMENTS pop-up comes up. Enter URL for the VARIABLE field and https://www.tutorialspoint.com for INITIAL VALUE. Then, click on Download as JSON.
Finally, choose a preferred location and click on Save.
Step 7 − Export the Environment to the same location where the Collection resides.
Step 8 − From the command-line move to the directory path where the Collection and the Environment is stored. Then, execute the command given below −
newman run <"file name">.
The file name should always be in inverted quotes; else it shall be taken as a directory name.
Common commandline arguments for Newman
The common command-line arguments for Newman are given below −
To execute a Collection in an Environment, the command is as follows −
newman run <name of Collection> -e <name of Environment>
To execute a Collection for a number of iterations, the command is as follows−
newman run <name of Collection> -n <iteration count>
To execute a Collection with data file, the command is as follows −
newman run <name of Collection> --data <name of file> -n <iteration count> -e <name of Environment>
Configure delay time in between requests, the command is as follows −
newman run <name of Collection> -d <time of delay>
Kickstart Your Career
Get certified by completing the courseGet Started