Configure request and collection runs using the Postman Runtime library

The Postman Runtime library is an open-source Node.js project you can use for low-level configuration over request sending in your API development and testing projects. It supports request sending and collection running in Postman and other interfaces including Newman, Postman's command-line collection runner.

Accessing the Postman Runtime library

To get started with the Runtime library, check out the repo's README.

You can install the library from npm. The following example code shows a simplified outline of using the Runtime library in conjunction with the Collection SDK:

runtime = require('postman-runtime');
var runner = new runtime.Runner();

// Collection object constructed using the Collection SDK
var collection = new sdk.Collection();

runner.run(collection, {
  data: [],
  timeout: {
    request: 30000,
    script: 5000
  },
  iterationCount: 1,

  //other options...

},
function (err, run) {
  // Callbacks to execute as the collection runs
  run.start(callbacks);
});

You can use the Runtime library if you need a detailed configuration of your request runs. For example, it can be used as part of an automation workflow to integrate Postman Collection runs into your development pipeline.

Note that if you only need to run collections, you can use Newman, Postman's command-line tool.

Next steps

After you've gotten started with the Runtime library, you might also want to use the Postman API in your continuous integration and continuous deployment (CI/CD) workflow:

  • To learn more about incorporating Postman into your CI/CD workflow, visit CI with Postman API.

Last modified: 2024/08/30