Azure DevOps | Installing Postman and Newman using npm
Installing Postman and Newman with npm
In this guide, we will walk through the steps to install Postman and Newman using npm (Node Package Manager) and how to run a Postman collection using Newman.
Prerequisites
- Node.js and npm installed on your system.
Install Postman
Postman provides a user-friendly graphical interface for creating and managing API requests and collections. To install Postman:
Open your terminal or command prompt.
Use npm to install the Postman command-line tool:
1
npm install -g postman
Once the installation is complete, you can run Postman by typing
postman
in your terminal.
Install Newman
Newman is a command-line collection runner for Postman that allows you to run and automate Postman collections. To install Newman:
Open your terminal or command prompt.
Use npm to install Newman globally:
1
npm install -g newman
Once the installation is complete, you can use Newman to run Postman collections from the command line.
Run a Postman Collection
Now that you have Postman and Newman installed, let’s run a Postman collection using Newman.
Export a Postman collection from the Postman application if you haven’t already. Save it as a JSON file (e.g.,
example_collection.json
).Open your terminal or command prompt.
Run the Postman collection using Newman:
1
newman run example_collection.json
Replace
example_collection.json
with the name of your Postman collection file.Newman will execute the requests in your collection and provide a summary of the results, including the number of requests run and their status.
What Next?
You’ve successfully installed Postman and Newman and used Newman to run a Postman collection from the command line. This is useful for automating API testing and integration into your CI/CD pipelines.