Skip to content

Instantly share code, notes, and snippets.

@vdespa
Created April 11, 2018 10:25
Show Gist options
  • Save vdespa/887df4af87baad916a44b749f744528d to your computer and use it in GitHub Desktop.
Save vdespa/887df4af87baad916a44b749f744528d to your computer and use it in GitHub Desktop.
const newman = require('newman');
newman.run({
collection: require('./postman_collection.json'),
reporters: 'cli'
}).on('start', function (error, args) { // on start of run, log to console
console.log('Running a collection...');
}).on('request', function (error, execution) {
if (error) {
console.error('collection run encountered an error.');
console.error(error);
}
else {
console.log(execution.response.stream.toString());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment