量角器-套件日志在茉莉花记者中分为多个套件

时间:2018-09-17 09:01:58

标签: jasmine protractor

我试图运行包含2个.js测试用例文件的测试套件。

报告配置位于下面的conf.js的onPrepare部分:

    onPrepare: function () {
            var jasmineReporters = require('jasmine-reporters');
            jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
                consolidate: true,
                savePath: path = './Logs/' + dateFormat(new Date(), "dddd_mmmm_dS_yyyy_h_MM_ss_TT"),
                filePrefix: result = 'xmlresults',
            }));

            var fs = require('fs-extra');

            fs.emptyDir(path + '/screenshots/', function (err) {
                console.log(err);
            });
            jasmine.getEnv().addReporter({
                specDone: function () {
                    if (specs.status == 'failed') {
                        browser.getCapabilities().then(function (caps) {
                            var browserName = caps.get('browserName');
                            browser.takeScreenshot().then(function (png) {
                                var stream = fs.createWriteStream('screenshots/' + browserName + '-' + specs.fullName + '.png');
                                stream.write(new Buffer(png, 'base64'));
                                stream.end();
                            });
                        });
                    }
                }
            });
        },
onComplete: function () {
        var browserName, browserVersion;
        var capsPromise = browser.getCapabilities();

        capsPromise.then(function (caps) {
            browserName = caps.get('browserName');
            browserVersion = caps.get('version');
            platform = caps.get('platform');

            var HTMLReport = require('protractor-html-reporter-2');

            testConfig = {
                reportTitle: 'Protractor Test Execution Report',
                outputPath: path,
                outputFilename: 'htmlresult',
                screenshotPath: './screenshots',
                testBrowser: browserName,
                browserVersion: browserVersion,
                modifiedSuiteName: false,
                screenshotsOnlyOnFailure: true,
                testPlatform: platform
            };
            new HTMLReport().from(path + '/' + result + '.xml', testConfig);
        });
    },

执行后,茉莉花html记者为图片:jasmine html reporter

有人可以帮助我将报告汇总为1个测试套件报告吗?

非常感谢您

0 个答案:

没有答案