you can run newman programtically also
var newman = require('newman');
newman.run({
collection: '/path/to/collection.json',
reporters: 'myreporter',
reporter: {
myreporter: {
'option-name': 'option-value' // this is optional
}
}
}, function (err, summary) {
if (err) { throw err; }
console.info('collection run complete!');
});
Newman-htmlreport using nodejs:
const newman = require('newman');
newman.run({
collection: './pathToFile/collection.json', // Collection URL from a public link or the Postman API can also be used
reporters: ['htmlextra'],
iterationCount: 1,
reporter: {
htmlextra: {
// export: './report.html',
// template: './template.hbs'
// logs: true,
// showOnlyFails: true,
// noSyntaxHighlighting: true,
// testPaging: true,
// browserTitle: "My Newman report",
// title: "My Newman Report",
// titleSize: 4,
// omitHeaders: true,
// skipHeaders: "Authorization",
// hideRequestBody: ["Login"],
// hideResponseBody: ["Auth Request"],
// showEnvironmentData: true,
// skipEnvironmentVars: ["API_KEY"],
// showGlobalData: true,
// skipGlobalVars: ["API_TOKEN"],
// skipSensitiveData: true,
// showMarkdownLinks: true,
// showFolderDescription: true,
// timezone: "Australia/Sydney"
}
}
});
You can use this to pass your collection and iteration data directory and run newman.run() in a forEach loop