Browse Source

Make the framed JUnit report deal with multiple reports for the same testcase.

PR: 32645
Submitted by:	Yves Martin <yves dot martin at elca dot ch>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277916 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
39a8bb4be6
5 changed files with 24 additions and 10 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +3
    -0
      WHATSNEW
  3. +9
    -9
      src/etc/junit-frames.xsl
  4. +4
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java
  5. +7
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java

+ 1
- 0
CONTRIBUTORS View File

@@ -219,4 +219,5 @@ Wolfgang Werner
Wolf Siberski Wolf Siberski
Yohann Roussel Yohann Roussel
Yuji Yamano Yuji Yamano
Yves Martin
Zdenek Wagner Zdenek Wagner

+ 3
- 0
WHATSNEW View File

@@ -378,6 +378,9 @@ Fixed bugs:


* Get with usetimestamp did not work when local timestamp roughly >= now. * Get with usetimestamp did not work when local timestamp roughly >= now.


* The framed JUnit report now handles multiple reports for the same
testcase properly. Bugzilla Report 32745.

Changes from Ant 1.6.1 to Ant 1.6.2 Changes from Ant 1.6.1 to Ant 1.6.2
=================================== ===================================




+ 9
- 9
src/etc/junit-frames.xsl View File

@@ -6,7 +6,7 @@
<xsl:output method="html" indent="yes" encoding="US-ASCII"/> <xsl:output method="html" indent="yes" encoding="US-ASCII"/>
<xsl:decimal-format decimal-separator="." grouping-separator=","/> <xsl:decimal-format decimal-separator="." grouping-separator=","/>
<!-- <!--
Copyright 2001-2004 The Apache Software Foundation
Copyright 2001-2005 The Apache Software Foundation


Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -91,16 +91,16 @@
<!-- for each class, creates a @name.html --> <!-- for each class, creates a @name.html -->
<!-- @bug there will be a problem with inner classes having the same name, it will be overwritten --> <!-- @bug there will be a problem with inner classes having the same name, it will be overwritten -->
<xsl:for-each select="/testsuites/testsuite[@package = $name]"> <xsl:for-each select="/testsuites/testsuite[@package = $name]">
<redirect:write file="{$output.dir}/{$package.dir}/{@name}.html">
<redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}.html">
<xsl:apply-templates select="." mode="class.details"/> <xsl:apply-templates select="." mode="class.details"/>
</redirect:write> </redirect:write>
<xsl:if test="string-length(./system-out)!=0"> <xsl:if test="string-length(./system-out)!=0">
<redirect:write file="{$output.dir}/{$package.dir}/{@name}-out.txt">
<redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-out.txt">
<xsl:value-of disable-output-escaping="yes" select="./system-out" /> <xsl:value-of disable-output-escaping="yes" select="./system-out" />
</redirect:write> </redirect:write>
</xsl:if> </xsl:if>
<xsl:if test="string-length(./system-err)!=0"> <xsl:if test="string-length(./system-err)!=0">
<redirect:write file="{$output.dir}/{$package.dir}/{@name}-err.txt">
<redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-err.txt">
<xsl:value-of disable-output-escaping="yes" select="./system-err" /> <xsl:value-of disable-output-escaping="yes" select="./system-err" />
</redirect:write> </redirect:write>
</xsl:if> </xsl:if>
@@ -262,7 +262,7 @@ h6 {
<xsl:if test="string-length(./system-out)!=0"> <xsl:if test="string-length(./system-out)!=0">
<div class="Properties"> <div class="Properties">
<a> <a>
<xsl:attribute name="href">./<xsl:value-of select="@name"/>-out.txt</xsl:attribute>
<xsl:attribute name="href">./<xsl:value-of select="@id"/>_<xsl:value-of select="@name"/>-out.txt</xsl:attribute>
System.out &#187; System.out &#187;
</a> </a>
</div> </div>
@@ -270,7 +270,7 @@ h6 {
<xsl:if test="string-length(./system-err)!=0"> <xsl:if test="string-length(./system-err)!=0">
<div class="Properties"> <div class="Properties">
<a> <a>
<xsl:attribute name="href">./<xsl:value-of select="@name"/>-err.txt</xsl:attribute>
<xsl:attribute name="href">./<xsl:value-of select="@id"/>_<xsl:value-of select="@name"/>-err.txt</xsl:attribute>
System.err &#187; System.err &#187;
</a> </a>
</div> </div>
@@ -325,7 +325,7 @@ h6 {
<xsl:sort select="@name"/> <xsl:sort select="@name"/>
<tr> <tr>
<td nowrap="nowrap"> <td nowrap="nowrap">
<a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
<a href="{@id}_{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
</td> </td>
</tr> </tr>
</xsl:for-each> </xsl:for-each>
@@ -366,7 +366,7 @@ h6 {
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:if test="not($package.name='')"> <xsl:if test="not($package.name='')">
<xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text> <xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text>
</xsl:if><xsl:value-of select="@name"/><xsl:text>.html</xsl:text>
</xsl:if><xsl:value-of select="@id"/>_<xsl:value-of select="@name"/><xsl:text>.html</xsl:text>
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="@name"/> <xsl:value-of select="@name"/>
</a> </a>
@@ -612,7 +612,7 @@ h6 {
<xsl:otherwise>Pass</xsl:otherwise> <xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:attribute>
<td><a href="{@name}.html"><xsl:value-of select="@name"/></a></td>
<td><a href="{@id}_{@name}.html"><xsl:value-of select="@name"/></a></td>
<td><xsl:apply-templates select="@tests"/></td> <td><xsl:apply-templates select="@tests"/></td>
<td><xsl:apply-templates select="@errors"/></td> <td><xsl:apply-templates select="@errors"/></td>
<td><xsl:apply-templates select="@failures"/></td> <td><xsl:apply-templates select="@failures"/></td>


+ 4
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2001,2004 The Apache Software Foundation
* Copyright 2001,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -86,6 +86,9 @@ public interface XMLConstants {
/** classname attribute for testcase elements */ /** classname attribute for testcase elements */
String ATTR_CLASSNAME = "classname"; String ATTR_CLASSNAME = "classname";


/** id attribute */
String ATTR_ID = "id";

/** /**
* timestamp of test cases * timestamp of test cases
*/ */


+ 7
- 0
src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java View File

@@ -73,6 +73,9 @@ public class XMLResultAggregator extends Task implements XMLConstants {
/** the default file name: <tt>TESTS-TestSuites.xml</tt> */ /** the default file name: <tt>TESTS-TestSuites.xml</tt> */
public static final String DEFAULT_FILENAME = "TESTS-TestSuites.xml"; public static final String DEFAULT_FILENAME = "TESTS-TestSuites.xml";


/** the current generated id */
protected int generatedId = 0;

/** /**
* Generate a report based on the document created by the merge. * Generate a report based on the document created by the merge.
* @return the report * @return the report
@@ -220,6 +223,8 @@ public class XMLResultAggregator extends Task implements XMLConstants {
Element rootElement = doc.createElement(TESTSUITES); Element rootElement = doc.createElement(TESTSUITES);
doc.appendChild(rootElement); doc.appendChild(rootElement);


generatedId = 0;

// get all files and add them to the document // get all files and add them to the document
File[] files = getFiles(); File[] files = getFiles();
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
@@ -234,6 +239,7 @@ public class XMLResultAggregator extends Task implements XMLConstants {
// make sure that this is REALLY a testsuite. // make sure that this is REALLY a testsuite.
if (TESTSUITE.equals(elem.getNodeName())) { if (TESTSUITE.equals(elem.getNodeName())) {
addTestSuite(rootElement, elem); addTestSuite(rootElement, elem);
generatedId++;
} else { } else {
// issue a warning. // issue a warning.
log("the file " + files[i] log("the file " + files[i]
@@ -278,6 +284,7 @@ public class XMLResultAggregator extends Task implements XMLConstants {
// modify the name attribute and set the package // modify the name attribute and set the package
copy.setAttribute(ATTR_NAME, classname); copy.setAttribute(ATTR_NAME, classname);
copy.setAttribute(ATTR_PACKAGE, pkgName); copy.setAttribute(ATTR_PACKAGE, pkgName);
copy.setAttribute(ATTR_ID, Integer.toString(generatedId));
} }


/** /**


Loading…
Cancel
Save