searls / jasmine-maven-plugin

Maven plugin to execute Jasmine Specs. Creates your HTML runners for you, runs headlessly, outputs JUnit XML
http://searls.github.io/jasmine-maven-plugin
Other
290 stars 163 forks source link

JUnit XML report not usable for SonarQube #280

Closed BBE78 closed 3 years ago

BBE78 commented 9 years ago

The generated JUnit XML report could not be used by SonarQube for the following reasons:

  1. all tests are reported in only one JUnit XML report --> they should have their own JUnit XML report
  2. test case time is set to "undefined", unparsable by SonarQube --> specify a correct time or "0" if not possible
  3. test case classname is always set to "jasmine": SonarQube is complaining that it could not find a test named "jasmine.js" --> specify the correct test file name

For example, in my project, I have the following javascripts sources:

And the following javascript tests:

Jasmine Maven plugin generates an "all in one" JUnit XML report:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" name="jasmine.specs" tests="8" failures="0" skipped="0" hostname="localhost" time="0.0" timestamp="2015-07-19T12:26:41">
    <testcase classname="jasmine" name="Tests suite for 'store.js' testing Store.getName()" time="undefined" failure="false"/>
    <testcase classname="jasmine" name="Tests suite for 'store.js' testing Store.add()" time="undefined" failure="false"/>
    <testcase classname="jasmine" name="Tests suite for 'store.js' testing Store.update()" time="undefined" failure="false"/>
    <testcase classname="jasmine" name="Tests suite for 'store.js' testing Store.remove()" time="undefined" failure="false"/>
    <testcase classname="jasmine" name="Tests suite for 'store.js' testing Store.clear()" time="undefined" failure="false"/>
    <testcase classname="jasmine" name="Tests suite for 'utils.js' testing convertInRadians()" time="undefined" failure="false"/>
    <testcase classname="jasmine" name="Tests suite for 'utils.js' testing formatDate2Time()" time="undefined" failure="false"/>
    <testcase classname="jasmine" name="Tests suite for 'utils.js' testing formatCurrentDate2Time()" time="undefined" failure="false"/>
</testsuite>

But to be "compliant" with SonarQube expectations, 2 differents JUnit XML reports should be generated as follow:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" name="jasmine.specs" tests="8" failures="0" skipped="0" hostname="localhost" time="0.0" timestamp="2015-07-19T12:26:41">
    <testcase classname="store-test.js" name="Tests suite for 'store.js' testing Store.getName()" time="0" failure="false"/>
    <testcase classname="store-test.js" name="Tests suite for 'store.js' testing Store.add()" time="0" failure="false"/>
    <testcase classname="store-test.js" name="Tests suite for 'store.js' testing Store.update()" time="0" failure="false"/>
    <testcase classname="store-test.js" name="Tests suite for 'store.js' testing Store.remove()" time="0" failure="false"/>
    <testcase classname="store-test.js" name="Tests suite for 'store.js' testing Store.clear()" time="0" failure="false"/>
</testsuite>
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" name="jasmine.specs" tests="8" failures="0" skipped="0" hostname="localhost" time="0.0" timestamp="2015-07-19T12:26:41">
    <testcase classname="utils-test.js" name="Tests suite for 'utils.js' testing convertInRadians()" time="0" failure="false"/>
    <testcase classname="utils-test.js" name="Tests suite for 'utils.js' testing formatDate2Time()" time="0" failure="false"/>
    <testcase classname="utils-test.js" name="Tests suite for 'utils.js' testing formatCurrentDate2Time()" time="0" failure="false"/>
</testsuite>
github-actions[bot] commented 3 years ago

This issue has been marked as stale because it has not been updated in 60 days. Please add a comment or this will be closed in 7 days.

github-actions[bot] commented 3 years ago

This issue was closed because it has been stalled for 7 days with no updates.