protractor icon indicating copy to clipboard operation
protractor copied to clipboard

JUnitXmlReporter won't generate XML output files

Open chun2014 opened this issue 12 years ago • 9 comments

I'm new to angular/protractor, and am trying to get JUnitXmlReporter to generate xml output files when I run protractor tests. The test run were successful, however no XML reports generated, I only see results in console where I run the tests. Below is the protractor.conf.js I used: exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', framework: 'jasmine', specs: ['e2e/app*.js'], capabilities: { browserName: 'chrome' },

// Options to be passed to Jasmine-node. onPrepare: function() {
var jasmineReporters = require('jasmine-reporters'); jasmine.getEnv().addReporter( new jasmineReporters.JUnitXmlReporter(null, true, true, 'testresults.e2e.') ); },

jasmineNodeOpts: { showColors: true, isVerbose: true, defaultTimeoutInterval: 30000 } } I have followed comments in other threads and tried to replace "null" in new jasmineReporters.JUnitXmlReporter(null, true, true, 'testresults.e2e.') with relative or abs paths as well, but no luck. When I tried with dir, I also made sure the dir was created beforehand, but after test run, that dir kept being empty. Any insights would be greately appreciated.

chun2014 avatar Jul 20 '14 21:07 chun2014

I tried to install jasmie-reporter with: npm install -g jasmine-reporter, the version installed from this command is 2.0.1, I read from other thread older version might work, so I tried install older version with command: npm install -g [email protected] for example, but no matter new or old version, none of them work for me. The jasmine-version for my env is 1.3.1 revision 1354556913

chun2014 avatar Jul 20 '14 21:07 chun2014

Hi @chun2014 try [email protected] this will definitely work.

And if you want html report then use following combination as well [email protected],
[email protected]

deveshmaheshwari avatar Jul 20 '14 21:07 deveshmaheshwari

I tried [email protected], still no luck. I set in protractor config a dir this time: jasmine.getEnv().addReporter( new jasmineReporters.JUnitXmlReporter('xmloutput', true, true, 'testresults.e2e.') ); And created a dir named 'xmloutput' under the folder where protractor config file resides. But after test run successfully, it's still empty. Looks like my reporter set up is not hooked up with the test run. Is there a way to debug this to make sure I have everything set up correctly? I have struggled with this for a long while now.

chun2014 avatar Jul 20 '14 22:07 chun2014

Changing the line to jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter('xmloutput', true, true)); may work for [email protected].

alexhokl avatar Jul 21 '14 07:07 alexhokl

Thanks Devesh and Alex! Now I got xml report generated for me.

Devesh, you mentioned I can also get html report working. I have installed the two packages you mentioned, what do I need to do to get html report?

chun2014 avatar Jul 21 '14 18:07 chun2014

Thanks! I got the xml report work with [email protected]. I also installed the two modules you mentioned for html reports. How should I change the protractor config file to make html reports work?

On Sunday, July 20, 2014 2:34 PM, deveshmaheshwari [email protected] wrote:

Hi @chun2014 try [email protected] this will definitely work. And if you want html report then use following combination

[email protected],

[email protected] — Reply to this email directly or view it on GitHub.

chun2014 avatar Jul 21 '14 20:07 chun2014

Please follow these well documented steps https://www.npmjs.org/package/protractor-html-screenshot-reporter

deveshmaheshwari avatar Jul 21 '14 21:07 deveshmaheshwari

Thanks! I'll follow this doc and give it a try.

On Monday, July 21, 2014 2:47 PM, deveshmaheshwari [email protected] wrote:

Please follow these well documented steps https://www.npmjs.org/package/protractor-html-screenshot-reporter — Reply to this email directly or view it on GitHub.

chun2014 avatar Jul 22 '14 06:07 chun2014

These questions seem answered and are well documented - closing this issue!

juliemr avatar Jul 22 '14 18:07 juliemr