0
0
PostmanConceptBeginner · 3 min read

What is Newman in Postman: Overview and Usage

Newman is a command-line tool that runs Postman collections outside the Postman app. It lets you automate API tests by running your saved Postman requests from the terminal or in CI/CD pipelines.
⚙️

How It Works

Newman works like a helper that takes your Postman API test collections and runs them on your computer without opening the Postman app. Imagine you have a recipe book (your Postman collection) and Newman is the chef who follows the recipes exactly to test your APIs.

It reads the collection file, sends the API requests one by one, checks the responses against your test scripts, and then shows you the results in the terminal. This makes it easy to include API testing in automated workflows, like running tests every time you update your code.

💻

Example

This example shows how to run a Postman collection file named mycollection.json using Newman from the command line.

bash
newman run mycollection.json
Output
newman → mycollection GET https://api.example.com/data [200 OK] ✓ Status code is 200 ┌─────────────────────────┬──────────┐ │ │ executed │ ├─────────────────────────┼──────────┤ │ iterations │ 1 │ │ requests │ 1 │ │ test-scripts │ 1 │ │ assertions │ 1 │ │ failed assertions │ 0 │ └─────────────────────────┴──────────┘ ✨ Done. 1 request(s) passed.
🎯

When to Use

Use Newman when you want to automate running your Postman API tests outside the Postman app. It is perfect for integrating API tests into continuous integration (CI) pipelines, so tests run automatically on every code change.

It also helps when you want to run tests on servers or environments without a graphical interface, or when you want to schedule tests to run regularly. Newman makes your API testing repeatable, consistent, and easy to include in your development workflow.

Key Points

  • Newman runs Postman collections from the command line.
  • It helps automate API testing in CI/CD pipelines.
  • Newman shows detailed test results in the terminal.
  • It supports running tests on servers without a GUI.
  • Easy to integrate with other tools and scripts.

Key Takeaways

Newman lets you run Postman API tests from the command line for automation.
It is ideal for integrating API tests into continuous integration workflows.
Newman provides clear test results directly in the terminal.
Use Newman to run tests on servers or environments without Postman app.
It makes API testing repeatable and easy to automate.