Issue Details (XML | Word | Printable)

Key: MPDASHBOARD-26
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Vincent Massol
Reporter: Wim Deblauwe
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Maven 1.x Dashboard Plugin

JUnit pass rate no longer showing

Created: 26/May/05 04:03 AM   Updated: 30/May/05 02:26 PM   Resolved: 30/May/05 02:26 PM
Return to search
Component/s: None
Affects Version/s: 1.8
Fix Version/s: 1.9

Time Tracking:
Not Specified

Environment:
Maven 1.0.2
Dashboard 1.9


 Description  « Hide

JUnit passrates are no longer showing when using dashboard version
1.9. I traced the problem down to the JUnit aggregator. It contains
these linen:

<j:choose>
<x:set var="nbTests" select="sum($doc/testsuites/testsuite/@tests)"/>
<a:echo>nr of tests: ${nbTests}</a:echo>
<j:when test="${nbTests != 0}">
<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>

The problem is that the xml file is being parsed after the nr of unit
tests has been calculated (using the $doc variable, but it is not
initialized yet). The solution: move the parsing of the xml file
higher, like this:

<x:parse var="doc" xml="${artifactAsFile}"/>
<j:choose>
<x:set var="nbTests" select="sum($doc/testsuites/testsuite/@tests)"/>
<a:echo>nr of tests: ${nbTests}</a:echo>
<j:when test="${nbTests != 0}">
<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>



Vincent Massol made changes - 26/May/05 04:31 AM
Field Original Value New Value
Affects Version/s 1.9 [ 11720 ]
Affects Version/s 1.8 [ 11540 ]
Vincent Massol added a comment - 29/May/05 02:57 PM

Wim, I'm trying to apply your patch but I don't understand it...

Could you please be more explicit (of course a SCM diff would be the best)? For example the junitpassrate.jelly file contains:

<j:jelly xmlns:j="jelly:core" xmlns:a="jelly:ant" 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()}">
<j:choose>
<x:set var="nbTests" select="sum($doc/testsuites/testsuite/@tests)"/>
<j:when test="${nbTests != 0}">
<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:when>
<j:otherwise>
<j:expr value="-"/>
</j:otherwise>
</j:choose>

</j:jelly>

What do you want to modify?

Thanks


Wim Deblauwe added a comment - 30/May/05 01:07 AM

Move this line:
<x:parse var="doc" xml="${artifactAsFile}"/>

above this line:
<x:set var="nbTests" select="sum($doc/testsuites/testsuite/@tests)"/>

Otherwise $doc is not yet initialized when you try to access it.


Vincent Massol added a comment - 30/May/05 02:26 PM

Applied thanks. I was not able to reproduce the problem using the existing test suite for the dashboard report...


Vincent Massol made changes - 30/May/05 02:26 PM
Status Open [ 1 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Assignee Vincent Massol [ vmassol ]
Fix Version/s 1.9 [ 11720 ]