RelationDigest

Thursday, 31 August 2023

[New post] How to run Postman requests from the command line

Site logo image vibssingh posted: " HOME In this tutorial, we will run the Postman requests from the command line. Newman is a command line collection runner for Postman. Table of Contents What is Newman? Implementation Steps Check if node.js is already installed or not " QA Automation Expert

How to run Postman requests from the command line

vibssingh

Aug 31

HOME

In this tutorial, we will run the Postman requests from the command line. Newman is a command line collection runner for Postman.

Table of Contents

  1. What is Newman?
  2. Implementation Steps
    1. Check if node.js is already installed or not
    2. Check if npm is already installed or not
    3. Install node.js
    4. Check if node.js and npm are successfully installed
    5. Install Newman
    6. Export the already created Postman tests
    7. Run the API collection through command line

What is Newman?

Newman enables you to run and test a Postman Collection directly from the command line. It's built with extensibility in mind so that you can integrate it with your continuous integration (CI) servers and build systems.

Let's learn about Newman and how to run the Postman collection using a command line.

Implementation Steps

Step 1: Check if node.js is already installed or not

Open your cmd from your machine

 node -v 

If found: 'node' is not recognized as an internal or external command, operable program, or batch file

That means node.js is not installed on your system yet.

Step 2: Check if npm is already installed or not

npm is node package manager which is used to installed packages over node.

 npm -v 

'npm' is not recognized as an internal or external command, operable program or batch file message means that node is not found in the system.

Step 3: Install node.js

Newman is node.js program and to get newman we have to first install node.js

Official site: https://nodejs.org/en/download/

Depending upon the system requirement, select and download 32-bit or 64-bit for Window or macOS operating system Node.js installer.

Once the installer finishes downloading, launch it. Open the downloads link in your browser and click the file. Or, browse to the location where you have saved the file and double-click it to launch. Click the "Next" button.

Select the option "I accept the terms in the License Agreement" and click the "Next" button.

The installer will prompt you for the installation location. Leave the default location, unless you have a specific need to install it somewhere else. Click the "Next" button.

This screen shows that npm package manager is also getting installed. Click the "Next" button.

Select the "Next" button.

Click on the "Install" button.

This screen shows that installation is in progress.

Click the "Finish" button to end the installation process.

Step 4: Check if node.js and npm are successfully installed

Close the cmd prompt and reopen the cmd prompt. Type node-v command and see if the version is displayed or not. The below image shows that node.js of version 18.17 is installed on the machine.

Type npm-v command and see if the version is displayed or not. The below image shows that npm of version 9.6.7 is installed on the machine.

Step 5: Install Newman

 npm install -g newman 

It will get Newman then install in your system. It will take couple of second.

After finishing the installation you can see it has added all the packages from contributors.

Step 6: Export the already created Postman tests

Export your Postman API collection as json file

This screen provides the option to export the json file as Collection v2 or Collection v2.1 and click on the "Export" button.

On cmd go to that location of collection json file

 cd C:\Users\Vibha\Desktop\Automation\Postman 

Step 7: Run the API collection through command line

 newman run API_Testing.json 

The output of the above command is shown below. There is a log of entire over all summary showing iterations, requests, test-scripts, prerequest-scripts, assertions, total run duration, total data received, average response time and in case of any failure we get the details of failure and all.

Congratulations!! We have run the Postman tests through command line. I hope this tutorial is useful to you.

Comment
Like
Tip icon image You can also reply to this email to leave a comment.

Unsubscribe to no longer receive posts from QA Automation Expert.
Change your email settings at manage subscriptions.

Trouble clicking? Copy and paste this URL into your browser:
http://qaautomation.expert/2023/08/31/how-to-run-postman-requests-from-the-command-line/

WordPress.com and Jetpack Logos

Get the Jetpack app to use Reader anywhere, anytime

Follow your favorite sites, save posts to read later, and get real-time notifications for likes and comments.

Download Jetpack on Google Play Download Jetpack from the App Store
WordPress.com on Twitter WordPress.com on Facebook WordPress.com on Instagram WordPress.com on YouTube
WordPress.com Logo and Wordmark title=

Automattic, Inc. - 60 29th St. #343, San Francisco, CA 94110  

at August 31, 2023
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Welcome to Letters from the Mire

Welcome, all from Wordpress and beyond! ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏ ...

  • [New post] Wiggle Kingdom: April Earnings on Spring Savings!
    Betsi...
  • [New post] Balancing the ‘E’ and ‘S’ in Environment, Social and Governance (ESG) crucial to sustaining liquidity and resilience in the African loan market (By Miranda Abraham)
    APO p...
  • Something plus something else
    Read on bl...

Search This Blog

  • Home

About Me

RelationDigest
View my complete profile

Report Abuse

Blog Archive

  • August 2025 (38)
  • July 2025 (59)
  • June 2025 (53)
  • May 2025 (47)
  • April 2025 (42)
  • March 2025 (30)
  • February 2025 (27)
  • January 2025 (30)
  • December 2024 (37)
  • November 2024 (31)
  • October 2024 (28)
  • September 2024 (28)
  • August 2024 (2729)
  • July 2024 (3249)
  • June 2024 (3152)
  • May 2024 (3259)
  • April 2024 (3151)
  • March 2024 (3258)
  • February 2024 (3046)
  • January 2024 (3258)
  • December 2023 (3270)
  • November 2023 (3183)
  • October 2023 (3243)
  • September 2023 (3151)
  • August 2023 (3241)
  • July 2023 (3237)
  • June 2023 (3135)
  • May 2023 (3212)
  • April 2023 (3093)
  • March 2023 (3187)
  • February 2023 (2865)
  • January 2023 (3209)
  • December 2022 (3229)
  • November 2022 (3079)
  • October 2022 (3086)
  • September 2022 (2791)
  • August 2022 (2964)
  • July 2022 (3157)
  • June 2022 (2925)
  • May 2022 (2893)
  • April 2022 (3049)
  • March 2022 (2919)
  • February 2022 (2104)
  • January 2022 (2284)
  • December 2021 (2481)
  • November 2021 (3146)
  • October 2021 (1048)
Powered by Blogger.