Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

newman

Package Overview
Dependencies
Maintainers
6
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

newman

Command-line companion utility for Postman

  • 6.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
580K
decreased by-18.89%
Maintainers
6
Weekly downloads
 
Created

What is newman?

Newman is a command-line collection runner for Postman. It allows you to 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.

What are newman's main functionalities?

Running Postman Collections

This feature allows you to run a Postman Collection from the command line. The code sample demonstrates how to use Newman to run a collection and output the results to the CLI.

const newman = require('newman');

newman.run({
  collection: require('./path/to/your/postman_collection.json'),
  reporters: 'cli'
}, function (err) {
  if (err) { throw err; }
  console.log('Collection run complete!');
});

Using Reporters

Newman supports multiple reporters to format the output of the collection run. This code sample shows how to use both CLI and JSON reporters and export the JSON report to a file.

const newman = require('newman');

newman.run({
  collection: require('./path/to/your/postman_collection.json'),
  reporters: ['cli', 'json'],
  reporter: {
    json: { export: './report.json' }
  }
}, function (err) {
  if (err) { throw err; }
  console.log('Collection run complete with reports!');
});

Integration with CI/CD

Newman can be integrated into CI/CD pipelines to automate API testing. This code sample demonstrates how to run a collection with an environment file and handle failures by exiting with a non-zero status code.

const newman = require('newman');

newman.run({
  collection: require('./path/to/your/postman_collection.json'),
  environment: require('./path/to/your/environment.json'),
  iterationCount: 1,
  reporters: 'cli'
}, function (err, summary) {
  if (err) { throw err; }
  if (summary.run.failures.length) {
    process.exit(1);
  }
  console.log('Collection run complete and passed!');
});

Other packages similar to newman

Keywords

FAQs

Package last updated on 14 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc