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

postman-runtime

Package Overview
Dependencies
Maintainers
5
Versions
231
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postman-runtime

Underlying library of executing Postman Collections

  • 7.43.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
454K
decreased by-33.59%
Maintainers
5
Weekly downloads
 
Created

What is postman-runtime?

The postman-runtime npm package is a core component of Postman that allows you to run Postman collections directly from Node.js. It provides a programmatic way to execute API requests, handle responses, and manage workflows defined in Postman collections.

What are postman-runtime's main functionalities?

Run Postman Collections

This feature allows you to run Postman collections programmatically. The code sample demonstrates how to load a Postman collection from a JSON file and execute it using the postman-runtime package.

const newman = require('postman-runtime');
const collection = require('./path/to/collection.json');

newman.run({
  collection: collection,
  reporters: 'cli'
}, function (err, summary) {
  if (err) { throw err; }
  console.log('Collection run complete!');
});

Handle Request and Response

This feature allows you to handle requests and responses within a Postman collection run. The code sample shows how to log the URL of each request and the status code of each response.

const newman = require('postman-runtime');
const collection = require('./path/to/collection.json');

newman.run({
  collection: collection
}, function (err, summary) {
  if (err) { throw err; }
  summary.run.executions.forEach(execution => {
    console.log('Request:', execution.request.url.toString());
    console.log('Response:', execution.response.code);
  });
});

Manage Environment Variables

This feature allows you to manage environment variables during a collection run. The code sample demonstrates how to load an environment file and access the environment variables after the collection run.

const newman = require('postman-runtime');
const collection = require('./path/to/collection.json');
const environment = require('./path/to/environment.json');

newman.run({
  collection: collection,
  environment: environment
}, function (err, summary) {
  if (err) { throw err; }
  console.log('Environment variables:', summary.environment.values);
});

Other packages similar to postman-runtime

Keywords

FAQs

Package last updated on 30 Oct 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