-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Junit Reporter #60
Comments
My 2 cents here: if you use Grunt as your build tool, you can run your Protractor tests using grunt-jasmine-node and configure it to get JUnit-like reports! |
How do to this in your configuration file in an only slightly hacky way - I've tested this out with Protractor's own test suite:
Your config file: require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter(
'outputdir/', true, true));
// The main suite of Protractor tests.
exports.config = {
seleniumServerJar: './selenium/selenium-server-standalone-2.35.0.jar',
chromeDriver: './selenium/chromedriver',
seleniumAddress: 'http://localhost:4444/wd/hub',
// Spec patterns are relative to this directory.
specs: [
'*_spec.js'
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:8000',
}; |
Further examples are now shown in https://github.com/angular/protractor/blob/master/spec/junitOutputConf.js |
Does it accept the relative path or absolute of directory.Absolute path is working while relative path not. I have tried options like ../Reports but its of no use |
explored and working , ignore my last comment |
I wasn't smart enough so I expected the folder to be created but in fact, the folder has to be created before hand. |
@juliemr How to use it with two Protractor instances running in parallel, e.g. via Maybe Protractor should know how to run in Parallel for reasons like that, similarly to what Karma does? |
@mzgol Have you tried making each target running as a concurrent task output a different junit xml report based on the platform? You could just create a new output folder based on the target name. You may also want to look into multi-configuration targets on Jenkins which let you run your build steps in parallel each with a clean environment. It also has nifty features like touchstone builds and allows you to throttle concurrency better than grunt. |
Does similar config exist for mocha? (as I am not using Jasmine) |
@mzgol I tried the suggestion from jvandyke(thank you) and it is working fine for me:
|
Thanks. Its working for me too: onPrepare: function(){ |
I have created an html reporter on top of this. Please let me know your comments |
It might be an idea to add the folder creation to docs as I tripped up on that too @tracycummins ! |
@juliemr Tired all options listed in samples. I get this error. Any pointers appreciated /home/jack/prototype/conf.js:19 // An example configuration file. // Spec patterns are relative to the current working directly when // Options to be passed to Jasmine-node. // Options to be passed to Jasmine-node. |
hey @jkmurthy I ran into the same exact issue. In the latest version of [email protected], they changed the module name. There is no documentation on this, but its there in this file. https://github.com/larrymyers/jasmine-reporters/blob/master/src/junit_reporter.js
Still I couldn't make it work as it says module 'jasmineReporters' undefined. So I switched to the older version of [email protected], it worked perfectly. Make sure you create the directory whichever you are referring as the output in reporter options. |
Downgrade jasmine-reporters to 0.4.1 did not work
No luck yet |
This is definitely an issue for me. Using jasmine-reporters 2.0 I get changing "new jasmine.JUnitXmlReporter" to "jasmineReporters.JUnitXmlReporter" results in jasmineReporters is undefined. If I revert jasmine-reporters back to 0.4.1 it works splendidly. |
jasmine-reporters 2.0 has different API than 1.x; you can't just blindly update; adjust your invocations. |
Looking at the comment in junit_reporter.js file for JUnitXmlReporter I have setup my conf file as follows: onPrepare: function () { this should work should it not? /** |
@john-bridges Can you wrap your code in back-ticks? It's hard to read without it. |
@john-bridges Well, no wonder the var jasmineReporters = require('jasmine-reporters'); |
@mzgol I am an idiot, works like a charm. Thanks for your help I appreciate it. |
The previous version of I see where the confusion came from. ;) |
@mzgol I agree, a much better way, thanks again. |
The proper way to get JUnitXmlReporter working with Jasmine 1.x is to slightly modify @juliemr 's original instructions:
Then follow the rest of her instructions as normal. |
I have overhauled the jasmine-reporters README to address the ways Thanks @ksraja for pointing out the seriously lacking documentation. |
Why does this issue keep getting closed, it is apparent that this is a issue still.
Throws error:
|
@jonniespratley I found that
After that, I updated protractor configuration as follows:
Now jasmine-reporters is working fine to me. |
In protractors' documentation for upgrading to jasmine2 framework, in the reporters section it would be nice if @luixaviles answer were documented. I can't imagine I'm the only one that had a difficult time figuring out how to get junit reports for jasmine2. Granted, once I found this and reread the current documentation it is clearer, but originally I mistakenly read it to mean jasmine-reporters didn't work (at all) with jasmine2. Having the above answer, or a link to jasmine-reporters' readme would make things a bit easier. |
tried the jasmine reports it ran good, but no xml file is been created i tried to got to https://github.com/angular/protractor/blob/master/spec/junitOutputConf.js, but gives 404 |
@spatchamatla Your example is using a weird combination of [email protected] syntax (ordered arguments) with what looks like the [email protected] reporter (jasmineReporters.JUnitXmlReporter vs jasmine.JUnitXmlReporter). Try using the correct syntax to create the reporter and see if you get further. Modified from the example in the jasmine-reporters README:
|
Make sure that the folder '../TestReports/test' exists as I think it fails On Wed, Apr 15, 2015 at 4:33 PM, Ben Loveridge [email protected]
|
Never a bad idea, though jasmine-reporters will use https://github.com/substack/node-mkdirp to try and create the directory. |
@bloveridge @spenoir , i downgraded to [email protected] and used the below
it started working, the only down side is its creating the folder in home directory rather than in project folder. When i tried using the project folder path, it still says Warning: writing junit report failed for '../TestReports', 'CHROME-41.0.2272.118-TestImpersonationPage.xml'. Reasons: i created the folder manually and still shows the above in the console |
is 'Protractor/TestReports' the correct path and does that folder exist? On Wed, Apr 15, 2015 at 5:01 PM, spatchamatla [email protected]
|
'Protractor/TestReports' is the path that been created in the home folder, then i used
and i manually created when i ran the test, it still gives |
you could try relaxing the permissions on the TestReports folder, Not sure On Wed, Apr 15, 2015 at 5:10 PM, spatchamatla [email protected]
|
Sure,Thanks @spenoir for your suggestions and input |
great thread. helped a lot. |
The example on the jasmine-reporters readme works for me: https://github.com/larrymyers/jasmine-reporters#protractor If you only need console output, I was pleased with https://github.com/bcaudan/jasmine-spec-reporter/blob/master/docs/protractor-configuration.md |
@josephdpurcell the link you provided also worked for me. Here is my config, I hope it helps! var folderName = ('output_folder');
var mkdirp = require('mkdirp');
mkdirp(folderName, function(err) {
if (err) {
console.error(err);
} else {
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: folderName,
filePrefix: 'xmloutput-'
}));
}
}); |
We want to run protractor tests on Jenkins, so it would be very useful if there was a junit reporter (like karma has) so the status of the tests can be reported by Jenkins
The text was updated successfully, but these errors were encountered: