How to use newman - 5 common examples

To help you get started, we’ve selected a few newman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github devinivy / hapipal-realworld-example-app / test / index.js View on Github external
await server.start();

        flags.onCleanup = async () => await server.stop();

        // Create a user to follow/unfollow (referenced within postman collection)

        await server.services().userService.signup({
            username: 'rick',
            password: 'secret-rick',
            email: 'rick@rick.com'
        });

        // Run postman tests

        const newman = Newman.run({
            reporters: 'cli',
            collection: require('./postman-collection.json'),
            environment: {
                values: [
                    {
                        enabled: true,
                        key: 'apiUrl',
                        value: `${server.info.uri}/api`,
                        type: 'text'
                    }
                ]
            }
        });

        await Toys.event(newman, 'done');
github postmanlabs / postman-code-generators / test / codegen / newman / runNewman.js View on Github external
function runNewman (collection, collectionName, done) {
  responses = [];
  newman.run({
    collection: collection
  }).on('beforeItem', function (err, summary) {
    if (err) {
      return done(err);
    }
    console.log('Sending request: ' + summary.item.name);
  }).on('request', function (err, summary) {
    if (err) {
      return done(err);
    }

    var stdout = summary.response.stream.toString();
    try {
      stdout = JSON.parse(stdout);
    }
    catch (e) {
github michaelruocco / gradle-postman-runner / src / main / resources / startnewman.js View on Github external
"use strict";

const newman = require('newman');

var config = JSON.parse(
    unescape(process.argv[2])
    .replace(new RegExp('<>', 'g'), '"'));

newman.run(config, function(err, summary) {
    if (err) {
       console.log(JSON.stringify(err, null, 1));
       process.exit(2);
    } else {
        if (summary.run.failures && summary.run.failures.length > 0) {
            process.exit(1);
        }
    }
});
github hantuzun / jetman / index.js View on Github external
exports.execute = function (testModules, newmanOptions, callback) {
  var pjson = require('./package.json')
  console.log('Jetman version ' + pjson.version)
  var collection = this.createCollection(testModules)
  var options = _.extend({collection: collection, reporters: 'cli'}, defaultNewmanOptions, newmanOptions)
  newman.run(
    options,
    callback
  )
}
github matt-ball / newman-action / index.js View on Github external
function runNewman (options) {
  newman.run(options).on('done', (err, summary) => {
    if (err || summary.run.failures.length) {
      core.setFailed('Newman run failed!' + (err || ''))
    }
  })
}

newman

Command-line companion utility for Postman

Apache-2.0
Latest version published 4 months ago

Package Health Score

75 / 100
Full package analysis

Popular newman functions