DEV Community

Hassan BOLAJRAF
Hassan BOLAJRAF

Posted on

Azure DevOps | Installing Postman and Newman using npm

Note
You can check other posts on my personal website: https://hbolajraf.net

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:

  1. Open your terminal or command prompt.

  2. Use npm to install the Postman command-line tool:

   npm install -g postman
Enter fullscreen mode Exit fullscreen mode
  1. 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:

  1. Open your terminal or command prompt.

  2. Use npm to install Newman globally:

   npm install -g newman
Enter fullscreen mode Exit fullscreen mode
  1. 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.

  1. Export a Postman collection from the Postman application if you haven't already. Save it as a JSON file (e.g., example_collection.json).

  2. Open your terminal or command prompt.

  3. Run the Postman collection using Newman:

   newman run example_collection.json
Enter fullscreen mode Exit fullscreen mode

Replace example_collection.json with the name of your Postman collection file.

  1. 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.

Top comments (0)