Added JUnit aggregators. Thanks to John D Taylor. John I had to change several things from your patch:

- remove tabs
- added missind documentation (xdoc)
- added missing tests
- it was not working. More specifically it would not work if the clover aggregators were used before the junit ones
- the goal caused by the junit aggregators was not the correct one... (you were calling "test" whereas it's the junit-report that must be called)

Please note that I had to modify both the Clover plugin and the junit-report one. So if you wish to use the junit aggregators you need to have the CVS versions of the these 2 plugins installed.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114431 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol committed 2003-11-29 19:11:31 +00:00
1 parent 80dfeb95d1
commit 1e4d5620ce
19 files changed
+164 -8

No files matched your search

+32 -5
View File
@@ -40,11 +40,20 @@ maven.dashboard.report.showempty = true
# ------------------------------------------------------------
# Location of default dashboard aggregators
maven.dashboard.aggregators.dir = ${plugin.resources}/reports
maven.dashboard.aggregators.dir = ${plugin.resources}/aggregators
# Comma-separated list of aggregators to use
maven.dashboard.aggregators = cserrors,cswarnings,clovertpc,cloverloc,cloverncloc
# Generated dashboard data for a single project
maven.dashboard.report.single = ${maven.build.dir}/dashboard-single.xml
# Decide whether to call goals associated with report types or not
maven.dashboard.rungoals = true
# Default aggregators
# -------------------
# Properties for the Checkstyle error/warning aggregator (all errors/warnings)
maven.dashboard.aggregator.csall.script = ${maven.dashboard.aggregators.dir}/csall.jelly
maven.dashboard.aggregator.csall.artifact = ${maven.build.dir}/checkstyle-raw-report.xml
@@ -81,8 +90,26 @@ maven.dashboard.aggregator.cloverncloc.artifact = ${maven.build.dir}/clover.xml
maven.dashboard.aggregator.cloverncloc.label = Clover NCLOC
maven.dashboard.aggregator.cloverncloc.goal = clover
# Generated dashboard data for a single project
maven.dashboard.report.single = ${maven.build.dir}/dashboard-single.xml
# Properties for the JUnit Test aggregator
maven.dashboard.aggregator.junittests.script = ${maven.dashboard.aggregators.dir}/junittests.jelly
maven.dashboard.aggregator.junittests.artifact = ${maven.build.dir}/TESTS-TestSuites.xml
maven.dashboard.aggregator.junittests.label = JUnit Tests
maven.dashboard.aggregator.junittests.goal = junit-report:report
# Decide whether to call goals associated with report types or not
maven.dashboard.rungoals = true
# Properties for the JUnit Failures aggregator
maven.dashboard.aggregator.junitfailures.script = ${maven.dashboard.aggregators.dir}/junitfailures.jelly
maven.dashboard.aggregator.junitfailures.artifact = ${maven.build.dir}/TESTS-TestSuites.xml
maven.dashboard.aggregator.junitfailures.label = JUnit Failures
maven.dashboard.aggregator.junitfailures.goal = junit-report:report
# Properties for the JUnit Errors aggregator
maven.dashboard.aggregator.juniterrors.script = ${maven.dashboard.aggregators.dir}/juniterrors.jelly
maven.dashboard.aggregator.juniterrors.artifact = ${maven.build.dir}/TESTS-TestSuites.xml
maven.dashboard.aggregator.juniterrors.label = JUnit Errors
maven.dashboard.aggregator.juniterrors.goal = junit-report:report
# Properties for the JUnit Pass Rate aggregator
maven.dashboard.aggregator.junitpassrate.script = ${maven.dashboard.aggregators.dir}/junitpassrate.jelly
maven.dashboard.aggregator.junitpassrate.artifact = ${maven.build.dir}/TESTS-TestSuites.xml
maven.dashboard.aggregator.junitpassrate.label = JUnit Pass Rate
maven.dashboard.aggregator.junitpassrate.goal = junit-report:report
+6
View File
@@ -46,6 +46,12 @@
</roles>
</developer>
</developers>
<contributors>
<contributor>
<name>John D Taylor</name>
<email>jdt@roe.ac.uk</email>
</contributor>
</contributors>
<dependencies/>
<reports>
<report>maven-changes-plugin</report>
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
========================================================================
JUnit aggregator. Extracts errors count from junit report
========================================================================
-->
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:u="jelly:util">
<u:file var="artifactAsFile"
name="${maven.dashboard.aggregator.junittests.artifact}"/>
<j:choose>
<j:when test="${artifactAsFile.exists()}">
<x:parse var="doc" xml="${artifactAsFile}"/>
<x:expr select="sum($doc/testsuites/testsuite/@errors)"/>
</j:when>
<j:otherwise>
<j:expr value="-"/>
</j:otherwise>
</j:choose>
</j:jelly>
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
========================================================================
JUnit aggregator. Extracts failures count from junit report
========================================================================
-->
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:u="jelly:util">
<u:file var="artifactAsFile"
name="${maven.dashboard.aggregator.junittests.artifact}"/>
<j:choose>
<j:when test="${artifactAsFile.exists()}">
<x:parse var="doc" xml="${artifactAsFile}"/>
<x:expr select="sum($doc/testsuites/testsuite/@failures)"/>
</j:when>
<j:otherwise>
<j:expr value="-"/>
</j:otherwise>
</j:choose>
</j:jelly>
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
========================================================================
JUnit aggregator. Calculates pass rate from junit report
========================================================================
-->
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:u="jelly:util">
<u:file var="artifactAsFile" name="${maven.dashboard.aggregator.junittests.artifact}"/>
<j:choose>
<j:when test="${artifactAsFile.exists()}">
<x:parse var="doc" xml="${artifactAsFile}"/>
<x:expr select="floor(100 - 100 * (sum($doc/testsuites/testsuite/@failures) + sum($doc/testsuites/testsuite/@errors)) div sum($doc/testsuites/testsuite/@tests))"/>
%
</j:when>
<j:otherwise>
<j:expr value="-"/>
</j:otherwise>
</j:choose>
</j:jelly>
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!--
========================================================================
JUnit aggregator. Extracts number of junit tests from JUnit test
report
========================================================================
-->
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:u="jelly:util">
<u:file var="artifactAsFile"
name="${maven.dashboard.aggregator.junittests.artifact}"/>
<j:choose>
<j:when test="${artifactAsFile.exists()}">
<x:parse var="doc" xml="${artifactAsFile}"/>
<x:expr select="sum($doc/testsuites/testsuite/@tests)"/>
</j:when>
<j:otherwise>
<j:expr value="-"/>
</j:otherwise>
</j:choose>
</j:jelly>
-1
View File
@@ -35,5 +35,4 @@
<assert:assertEquals expected="4" value="${count.intValue().toString()}"/>
</goal>
</project>
@@ -5,6 +5,4 @@ maven.xdoc.date=left
maven.xdoc.version=${pom.currentVersion}
maven.checkstyle.header.file = ${basedir}/LICENSE.txt
maven.dashboard.aggregators = csall,cserrors,cswarnings,clovertpc,cloverloc,cloverncloc
offline=true
@@ -4,3 +4,5 @@
maven.xdoc.date=left
maven.xdoc.version=${pom.currentVersion}
maven.checkstyle.header.file = ${basedir}/../LICENSE.txt
maven.dashboard.aggregators = csall,cserrors,cswarnings,clovertpc,cloverloc,cloverncloc,junittests,junitpassrate,junitfailures,juniterrors
@@ -4,3 +4,5 @@
maven.xdoc.date=left
maven.xdoc.version=${pom.currentVersion}
maven.checkstyle.header.file = ${basedir}/../LICENSE.txt
maven.dashboard.aggregators = csall,cserrors,cswarnings,clovertpc,cloverloc,cloverncloc,junittests,junitpassrate,junitfailures,juniterrors
@@ -4,3 +4,5 @@
maven.xdoc.date=left
maven.xdoc.version=${pom.currentVersion}
maven.checkstyle.header.file = ${basedir}/../LICENSE.txt
maven.dashboard.aggregators = csall,cserrors,cswarnings,clovertpc,cloverloc,cloverncloc,junittests,junitpassrate,junitfailures,juniterrors
+28
View File
@@ -62,6 +62,34 @@
Computes total Non-Commented Line Of Code (NCLOC) using Clover.
</td>
</tr>
<tr>
<td>junittests</td>
<td>JUnit</td>
<td>
Number of JUnit tests.
</td>
</tr>
<tr>
<td>juniterrors</td>
<td>JUnit</td>
<td>
Number of JUnit errors.
</td>
</tr>
<tr>
<td>junitfailures</td>
<td>JUnit</td>
<td>
Number of JUnit failures.
</td>
</tr>
<tr>
<td>junitpassrate</td>
<td>JUnit</td>
<td>
Percentage of JUnit tests that have passed.
</td>
</tr>
</table>
</section>
</body>
+3
View File
@@ -8,6 +8,9 @@
<body>
<release version="1.2" date="in CVS">
<action dev="vmassol" due-to="John D Taylor">
Added JUnit aggregators.
</action>
<action dev="vmassol" type="add">
Added tutorial on how to create custom aggregators.
</action>