Using Newman
Last modified on Fri 22 Jul 2022

Hello, Jerry!

Sometimes you need to combine the power of Postman with your regular old CI/CD services. That's where Newman comes in handy.

What is Newman?

Without mincing words, Newman is:

a command-line collection runner for Postman. It allows you to effortlessly run and test a Postman collection directly from the command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.

The above is taken directly from Newman's npmjs page.

Use cases

Here are some use cases where your utilizing Newman over plain Postman makes sense:

Installation

Prerequisites

Installing Newman

Usage as a CLI tool

Running a local collection

Running a remote collection

This option is more interesting because it allows you to make changes in Postman collections and environments without having to manually fetch the aforementioned JSON files.

Every time your tests run, they will run the latest and the greatest tests you have in your Postman workspace.

cd.jpg

ed.jpg

Adding a variable to your existing environment

Let's say you have a Selenium script that fetches the token. You can save that token to an env variable and then forward it to Newman like so:

Sending reports to Slack

You can also easily send test reports with Slack by simply modifying the aforementioned command:

Usage as a JS lib

You can also use Newman as a fully fledged Node.js lib, but we won't go into detail on that particular topic.

Find more info on the npmjs page.

Docs

For more info on all params and other use cases, check out their GitHub page.