dion 2004/01/29 20:57:40
Modified: junit-report/xdocs changes.xml
junit-report/src/plugin-resources junit.jsl
junit-report project.xml
Log:
Apply MPJUNITREPORT-3
Revision Changes Path
1.8 +6 -0 maven-plugins/junit-report/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven-plugins/junit-report/xdocs/changes.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- changes.xml 29 Jan 2004 04:02:16 -0000 1.7
+++ changes.xml 30 Jan 2004 04:57:40 -0000 1.8
@@ -8,6 +8,12 @@
<body>
+ <release version="1.5" date="in CVS">
+ <action dev="dion" type="update">
+ Apply MPJUNITREPORT-3
+ </action>
+ </release>
+
<release version="1.4" date="2004-01-29">
<action dev="vmassol" type="update">
Added new goal <code>junit-report:report</code> which is is the same
1.7 +130 -55 maven-plugins/junit-report/src/plugin-resources/junit.jsl
Index: junit.jsl
===================================================================
RCS file: /home/cvs/maven-plugins/junit-report/src/plugin-resources/junit.jsl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- junit.jsl 5 Aug 2003 02:34:22 -0000 1.6
+++ junit.jsl 30 Jan 2004 04:57:40 -0000 1.7
@@ -11,24 +11,14 @@
xmlns:doc="doc"
trim="false">
- <!-- This needs to be instantiated here to be available in the template matches
-->
- <j:useBean var="mavenTool" class="org.apache.maven.util.MavenTool"/>
- <j:useBean var="numbers" class="java.text.DecimalFormat"/>
- <j:useBean var="htmlescape" class="org.apache.velocity.anakia.Escape"/>
- <j:useBean var="formatter" class="org.apache.maven.util.DVSLFormatter"/>
- <j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/>
- <j:useBean var="pathtool" class="org.apache.maven.util.DVSLPathTool"/>
-
+ <j:useBean var="stringTool" class="org.apache.maven.util.StringTool"/>
<define:taglib uri="junit">
<define:tag name="nav">
<p>
- [
- <a href="#Summary">summary</a>]
- [
- <a href="#Package List">package list</a>]
- [
- <a href="#Test Cases">test cases</a>]
+ [<a href="#Summary">summary</a>]
+ [<a href="#Package List">package list</a>]
+ [<a href="#Test Cases">test cases</a>]
</p>
</define:tag>
@@ -55,7 +45,7 @@
<j:choose>
<j:when test="${current.attribute('message') != null}">
<code>
- ${htmlescape.getText(current.attribute('message').value)}
+${current.attributeValue('message')}
</code>
</j:when>
<j:otherwise>
@@ -63,6 +53,22 @@
</j:otherwise>
</j:choose>
</define:tag>
+
+ <!-- defined here to easily change images globally or set up relative paths -->
+ <define:tag name="displayImage">
+ <j:choose>
+ <j:when test="${kind == 'failure'}">
+ <img src="images/icon_warning_sml.gif" width="15" height="15"
alt="Failure" />
+ </j:when>
+ <j:when test="${kind == 'error'}">
+ <img src="images/icon_error_sml.gif" width="15" height="15" alt="Error" />
+ </j:when>
+ <j:when test="${kind == 'success'}">
+ <img src="images/icon_success_sml.gif" width="15" height="15"
alt="Success" />
+ </j:when>
+ </j:choose>
+ </define:tag>
+
</define:taglib>
<jsl:template match="testsuites">
@@ -80,14 +86,16 @@
<j:set var="failureCount"><x:expr
select="sum(testsuite/@failures)"/></j:set>
<j:set var="timeCount"><x:expr select="sum(testsuite/@time)"/></j:set>
<j:set var="successRate"><x:expr select="($testCount - ($failureCount +
$errorCount)) div $testCount"/></j:set>
- <table>
- <tr>
- <th>Tests</th>
- <th>Errors</th>
- <th>Failures</th>
- <th>Success rate</th>
- <th>Time(s)</th>
- </tr>
+ <table summary="JUnit result summary">
+ <thead>
+ <tr>
+ <th>Tests</th>
+ <th>Errors</th>
+ <th>Failures</th>
+ <th>Success rate</th>
+ <th>Time(s)</th>
+ </tr>
+ </thead>
<tr>
<td>
<doc:formatAsNumber string="${testCount}" pattern="0"/>
@@ -116,10 +124,12 @@
<section name="Package List">
<junit:nav/>
- <table>
- <tr>
-
<th>Package</th><th>Tests</th><th>Errors</th><th>Failures</th><th>Success
Rate</th><th>Time</th>
- </tr>
+ <table summary="Package List">
+ <thead>
+ <tr>
+
<th>Package</th><th>Tests</th><th>Errors</th><th>Failures</th><th>Success
Rate</th><th>Time</th>
+ </tr>
+ </thead>
<x:set var="testsuites" select="./testsuite[not(./@package =
preceding-sibling::testsuite/@package)]"/>
<j:forEach var="testsuite" items="${testsuites}">
<j:set var="package" value="${testsuite.attribute('package').value}"/>
@@ -162,16 +172,33 @@
<a name="${package}"></a>
<subsection name="${package}">
- <table>
- <tr>
-
<th>Class</th><th>Tests</th><th>Errors</th><th>Failures</th><th>Success
Rate</th><th>Time</th>
- </tr>
+ <table summary="Tests for ${package}">
+ <thead>
+ <tr>
+ <th
colspan="2">Class</th><th>Tests</th><th>Errors</th><th>Failures</th><th>Success
Rate</th><th>Time</th>
+ </tr>
+ </thead>
<x:forEach var="test" select="/testsuites/testsuite[./@package =
$quotedPackage]">
<j:set var="testCount"><x:expr
select="${test.attribute('tests').value}" /></j:set>
<j:set var="errorCount"><x:expr
select="${test.attribute('errors').value}" /></j:set>
<j:set var="failureCount"><x:expr
select="${test.attribute('failures').value}" /></j:set>
<j:set var="successRate"><x:expr select="($testCount -
($failureCount + $errorCount)) div $testCount"/></j:set>
<tr>
+ <td>
+ <j:choose>
+ <j:when test="${errorCount != 0}">
+ <junit:displayImage kind="error" />
+ </j:when>
+ <j:when test="${failureCount != 0}">
+ <junit:displayImage kind="failure" />
+ </j:when>
+ <j:otherwise>
+ <junit:displayImage kind="success" />
+ </j:otherwise>
+ </j:choose>
+
+ </td>
+
<td>
<a
href="#${test.attribute('name').value}">${test.attribute('name').value}</a>
</td>
@@ -204,14 +231,7 @@
<j:forEach var="testsuite" items="${testsuites}">
<a name="${testsuite.attribute('name').value}"></a>
<subsection name="${testsuite.attribute('name').value}">
- <table>
- <!--
- <junit:testCaseHeader/>
- -->
-
- ## test can even not be started at all (failure to load the class)
- ## so report the error directly
- ##
+ <table summary="Testsuite: ${testsuite.attribute('name').value}">
<x:set var="errors" select="$testsuite/error"/>
<j:forEach var="error" items="${errors}">
@@ -228,41 +248,43 @@
<j:forEach var="testcase" items="${testcases}">
<j:set var="failure"
value="${testcase.selectSingleNode('failure')}"/>
<j:set var="error" value="${testcase.selectSingleNode('error')}"/>
+ <j:set var="testname"
value="${testcase.attribute('name').value}"/>
<tr>
- <td>${testcase.attribute("name").value}</td>
+
+ <td style="width:20px">
<j:choose>
<j:when test="${failure != null}">
- <td style="width: 60px; color: red; font-weight:
bold">Failure</td>
+ <a href="#${testname}"><junit:displayImage kind="failure"
/></a>
</j:when>
<j:when test="${error != null}">
- <td style="width: 60px; color: red; font-weight:
bold">Error</td>
- </j:when>
- <j:otherwise>
- <td style="width: 60px;">Success</td>
- </j:otherwise>
- </j:choose>
- <j:choose>
- <j:when test="${testcase.attribute('time') != null}">
- <td width="60px">
- <doc:formatAsNumber
string="${testcase.attribute('time').value}" pattern="0.00"/>
- </td>
+ <a href="#${testname}"><junit:displayImage kind="error"
/></a>
</j:when>
<j:otherwise>
- <td width="60px"></td>
+ <junit:displayImage kind="success" />
</j:otherwise>
</j:choose>
+
+ </td>
+
+ <td style="width:98%">${testcase.attribute("name").value}</td>
+
+ <td style="width:60px">
+ <j:if test="${testcase.attribute('time') != null}">
+ <doc:formatAsNumber
string="${testcase.attribute('time').value}" pattern="0.00"/>
+ </j:if>
+ </td>
</tr>
<j:choose>
<j:when test="${failure != null}">
<tr>
- <td colspan="3" style="padding-left: 50px">
+ <td colspan="3" style="padding-left: 20px">
<junit:displayFailure current="${failure}"/>
</td>
</tr>
</j:when>
<j:when test="${error != null}">
<tr>
- <td colspan="3" style="padding-left: 50px">
+ <td colspan="3" style="padding-left: 20px">
<junit:displayFailure current="${error}"/>
</td>
</tr>
@@ -273,6 +295,59 @@
</subsection>
</j:forEach>
</section>
+
+ <x:set var="errorCheck" select="/testsuites/testsuite/testcase/*" />
+ <j:if test="${!empty(errorCheck)}">
+
+ <section name="Failure details">
+
+ <x:forEach var="testcase" select="/testsuites/testsuite/testcase"
trim="false">
+ <j:set var="failure"
value="${testcase.selectSingleNode('failure')}"/>
+ <j:set var="error" value="${testcase.selectSingleNode('error')}"/>
+ <j:if test="${empty(failure)}">
+ <j:set var="failure" value="${error}"/>
+ </j:if>
+
+ <j:if test="${!empty(failure)}">
+ <j:set var="testname"
value="${testcase.attribute('name').value}"/>
+ <table summary="Failure details for ${testname}">
+ <thead>
+ <tr>
+ <td style="width:20px">
+ <j:choose>
+ <j:when test="${!empty(error)}">
+ <junit:displayImage kind="error" />
+ </j:when>
+ <j:otherwise>
+ <junit:displayImage kind="failure"/>
+ </j:otherwise>
+ </j:choose>
+ </td>
+ <td style="width:96%"><strong><a
name="${testname}">${testname}</a></strong></td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td colspan="2"><junit:displayFailure
current="${failure}"/></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <!-- removing stacktrace generated by maven -->
+ <!-- no way to preserve newlines, jelly strips out
everything -->
+<code>
+${stringTool.splitStringAtLastDelim(stringTool.splitStringAtLastDelim(failure.text,
'at org.apache.commons.jelly.tags.ant.AntTag.doTag').get(0),
+'at sun.reflect.NativeMethodAccessorImpl.invoke0(').get(0)}
+</code>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </j:if>
+
+ </x:forEach>
+ </section>
+ </j:if>
+
</body>
</document>
</jsl:template>
1.22 +1 -1 maven-plugins/junit-report/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven-plugins/junit-report/project.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- project.xml 29 Jan 2004 04:02:16 -0000 1.21
+++ project.xml 30 Jan 2004 04:57:40 -0000 1.22
@@ -5,7 +5,7 @@
<pomVersion>3</pomVersion>
<id>maven-junit-report-plugin</id>
<name>Maven JUnit Report Plug-in</name>
- <currentVersion>1.4</currentVersion>
+ <currentVersion>1.5-SNAPSHOT</currentVersion>
<description/>
<shortDescription>Reports from JUnit tests</shortDescription>
<url>http://maven.apache.org/reference/plugins/junit-report/</url>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]