Post

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:

  1. Open your terminal or command prompt.

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

    1
    
    npm install -g postman
    
  3. 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:

    1
    
    npm install -g newman
    
  3. 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:

    1
    
    newman run example_collection.json
    

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

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

This post is licensed under CC BY 4.0 by the author.