将新的测试结果追加到现有的纽曼报告中

时间:2018-09-26 11:20:22

标签: postman newman postman-collection-runner

我正在使用以下代码段通过POSTMAN的npm模块运行文件夹中的所有集合:

#!/usr/bin/env node
/**
 * @fileOverview Read all collection files within a directory and run them
 * in parallel.
 */
var newman = require('../'), // require('newman')
    fs = require('fs');

fs.readdir('./examples', function (err, files) {
    if (err) { throw err; }

    //Filter all files with JSON file extension
    files = files.filter(function (file) {
        return (/^((?!(package(-lock)?))|.+)\.json/).test(file);
    });

    //Iterate on each file name and call newman.run using each file name
    files.forEach(function (file) {
        newman.run({
            collection: require(`${__dirname}/${file}`)
        }, function (err) {
            // finally, when the collection executes, print the status
            console.info(`${file}: ${err ? err.name : 'ok'}!`);
        });
    }); 
});

如果我尝试使用

{
    collection: require(`${__dirname}/${file}`),
    reporters: 'html',
    reporter: { html: { export: './result/htmlResults.html', template: './templates/htmlTemplate.hbs' } }
}

代替

{
    collection: require(`${__dirname}/${file}`)
}

newman.run运行的每个新集合都会覆盖报告文件htmlResults.html。我正在寻找一种将新集合中的测试数据附加到现有报告中的方法。有没有办法做到这一点?

注意:我不想创建多个报告文件(每个馆藏都有单独的报告)

0 个答案:

没有答案
相关问题