Unable to generate Report when using jasmine-reporters in protractor

穿精又带淫゛_ 提交于 2019-12-23 15:52:13

问题


i Used the following code in config

var jasmineReporters = require('jasmine-reporters');    
onPrepare: function() {
    browser.driver.manage().window().maximize();
    browser.params.envi='DEVINT';
    //For output reports
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter('./test', true, true));

},

When i ran the tests it ran successfully, but im not seeing any reports generated.

Any Suggestions?


回答1:


Not sure it would help but here is what is working for me:

onPrepare: function () {
    require("jasmine-reporters");

    // junit reporter
    var capsPromise = browser.getCapabilities();
    capsPromise.then(function (caps) {
        var browserName = caps.caps_.browserName.toUpperCase();
        var browserVersion = caps.caps_.version;
        var prePendStr = browserName + "-" + browserVersion + "-";
        jasmine.getEnv().addReporter(new
            jasmine.JUnitXmlReporter("test-results", true, true, prePendStr));
    });
},

Using jasmine 1.3, jasmine-reporters 1.0.1, protractor 2.0.




回答2:


I had the same problem. It was sloved by:

framework: "jasmine2",  //must set it if you use JUnitXmlReporter

    onPrepare: function(){  //configure junit xml report

        var jasmineReporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
            consolidateAll: true,
            filePrefix: 'guitest-xmloutput',
            savePath: 'test/reports'
        }));

    },

Look on the current documentation of https://github.com/larrymyers/jasmine-reporters. At the bottom is the instruction for protractor. I solved the same problem by adding this to protractor.conf.js




回答3:


s-patchamatla You need to downgrade version of Jasmine to jasmine-reporters@1.0.0

Newer versions of jasmine reporters does no longer attaches to the Jasmine object

so, in case you tried to use jasmine-reporters with Protractor, you need to use a 1.x version of jasmine-reporters.

npm install jasmine-reporters@~1.0.0

onPrepare: function () {
    require("jasmine-reporters");

    // junit reporter
    var capsPromise = browser.getCapabilities();
    capsPromise.then(function (caps) {
        var browserName = caps.caps_.browserName.toUpperCase();
        var browserVersion = caps.caps_.version;
        var prePendStr = browserName + "-" + browserVersion + "-";
        jasmine.getEnv().addReporter(new
            jasmine.JUnitXmlReporter(<report path>, true, true, prePendStr));
    });
}

i guess this should work for you.



来源:https://stackoverflow.com/questions/29652810/unable-to-generate-report-when-using-jasmine-reporters-in-protractor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!