karma-junit-reporter
karma-junit-reporter copied to clipboard
SonarQube don't import unit test results anymore
The latest version of JavaScript Plugin (2.10) from SonarQube removes the ability to import unit test results using JUnit format, they recommend to use another plugin (Generic Coverage) that uses a different XSD Schema.
Anyone uses this feature? Do you have any solution for that?
It's related to #69
This another reporter is compliance with Generic Coverage Plugin: https://github.com/tornaia/karma-sonarqube-unit-reporter
the mentioned plugin isn't functional on my project; but imho it is a very good feature for this plugin to comply to the somewhat more strict XSD Schema so SonarQube is supported out-of-the-box with some settings
Sorry, what is imho? Do you import test results from Karma execution to SonarQube using other tool? Which setting do you use?
I also faced that issue when make integration with Sonar
Hi,
Is there any plan to support new Sonar format for reporting test result ? https://docs.sonarqube.org/display/PLUG/Generic+Test+Coverage
Reporters out there supporting this new format are not actively maintained. It would be great if the karma team supports it !
Maybe a new plugin to keep backward compatibility with the old format ? Or an option in this plugin asking for format ?
Best regards.
Good question, whether to keep this plugin as-is and make a new one. @r0main
Anyhow, on the surface, the new Sonar XSD (schema) would mean only changing a couple of strings in the index.js of this plugin.
So if the "rules" themselves are as they were in the older schema, the change is quite small. (Does someone read XSD ? :)
I'll take a shot at it.
Code ready in PR 117, please try it out and report on findings.
I have validated the new XML being produced by the pull request, against Sonar's XSD schema file. What I would really like to know is does the new XML satisfy a running SonarQube.
Of course also very interested to see whether there's any other issue. Tried to keep everything already working in status quo, ie. not disturb old code.
Two things for testing: i) add a new config line into karma.conf.js The essential line is thus the last line in snippet below:
junitReporter: {
outputDir: './test_out',
outputFile: undefined,
suite: '',
useBrowserName: 'false',
nameFormatter: undefined,
classNameFormatter: undefined,
properties: {},
xmlVersion: 1
}
ii) place the new index.js from the pull request, blob below: https://github.com/jpaulin/karma-junit-reporter/blob/34303edae95d967d06dfd31d91f7b179d3bbcba8/index.js
tnx for the effort @jpaulin PR #117 is merged is see 👍
Thank you @jpaulin very much for adding this support! I have done some testing and found a couple of open items:
"skipped" tests require a message attribute.
A
@bmorenc This is good feedback, big thanks. As the code in my PR was rather large, I see that definitely missed these - I had too narrow test coverage, kind of, and thus was only testing for the obvious "positive" cases of test results, ie: 1. test passes or 2. A test fails. I see there are those issues in the code, will fix these.
Thanks @jpaulin for this!
I noticed that the output has: <file path="fixedString">
SonarQube documentation says that this should be either absolute or relative path the the test file.
Is this maybe something that is already being worked on or something that could be contributed with?