Hello Newman guys,
I need to execute collections in SEQUENTIALLY because collections interact together.
Below you can see details.
Version and environment information:
-->
newman -v): 3.8.3Steps to reproduce the problem:
Detail you can see in the mails Chris de Sousa (Postman) help@getpostman.com with subject:
"Newman: Execute all collections from directory sequentially"
@xsedlak While the default example you've mentioned runs collections in parallel, it can be tweaked for serial runs as follows:
var fs = require('fs'),
async = require('async'), // https://npmjs.org/package/async
newman = require('newman');
fs.readdir('./examples', function (err, files) {
if (err) { throw err; }
// we filter all files with JSON file extension
files = files.filter(function (file) {
return (file.substr(-5) === '.json');
});
// now wer iterate on each file name and call newman.run using each file name
async.eachSeries(files, function (file, next) {
newman.run({
collection: require(`${__dirname}/${file}`)
}, function (err, summary) {
// finally, when the collection executes, print the status
console.info(`${file}: ${err ? err.name : 'ok'}!`);
next(err, summary);
});
}, function (err, results) {
// process the errors/results here
});
});
Most helpful comment
@xsedlak While the default example you've mentioned runs collections in parallel, it can be tweaked for serial runs as follows: