Search code examples
javascriptjasmineprotractorjasmine-reporters

Unable to generate xml reports using JUnitXmlReporter


When I am trying to generate xml output files using JUnitXmlReporter, the test run is successful, but no XML reports are generated, I only see results in console where I run the tests. Below is the conf.js file that I used:

exports.config = {
      seleniumAddress: 'http://localhost:4444/wd/hub',

      capabilities: {
          'browserName': 'firefox'
      },

      specs: ['spec1.js'],

      jasmineNodeOpts: {
           onComplete: null,
           isVerbose: true,
           showColors: true,
           includeStackTrace: true
      },

      onPrepare: function() {
          var jasmineReporters = require('C:/Users/swati.m.khandelwal/node_modules/jasmine-reporters');
          jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter('./output', true, true)
          );
     }
   };

P.S. I am successfully able to generate HTML reports (using 'protractor-html-screenshot-reporter') but not XML reports anyhow.

Please help me in this regard.


Solution

  • I suspect you are using jasmine-reporters 2.x which is made to work with jasmine2 while protractor is using jasmine1. If you are planning to stay with jasmine1, install jasmine-reporters 1.x:

    npm install --save-dev jasmine-reporters@^1.0.0