Search code examples
jasmineprotractorjasmine-nodegrunt-contrib-jasmine

How to generate only one single XML result with jasmine-report and protractor


I have one single protractor project with following dependencies in packages.json:

  • 'protractor'
  • 'grunt-protractor-runner'
  • 'grunt-jasmine-node'
  • 'jasmine-reporters'

I have this protractor-config:

exports.config =
  specs: [
    'build/test/e2e/**/*_spec.js'
  ]

capabilities:
browserName: "chrome"

onPrepare: () ->
    require('jasmine-reporters')
    jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter("test/reports/e2e", 
                                 false, true))
  1. It ran 20 tests and they finished properly, but under the "test/reports/e2e" directory multiple XML files were generated (1 XML file is generated per test). How can I generate results of these 20 tests into one only xml file, like this?
<testsuite ....>
    <testcase classname="..." name="..." time="0.008"/>
    <testcase classname="..." name="..." time="0.002"/>
    <testcase classname="..." name="..." time="0.108"/>
    <testcase classname="..." name="..." time="0.004"/>
    <testcase classname="..." name="..." time="0.002"/>
</testsuite>
  1. Is there a framework or plugin for translating this XML result into a readable format (e.g. html)

Note: I am not using mocha nor karma.


Solution

  • JUnitXmlReporter() and JUnit format specifically was not designed to be read by humans. It is a specific format that your Continuous Integration server (like jenkins) knows how to understand, parse and show readable results.

    If you want to see an HTML report, there is protractor-html-screenshot-reporter package.