Browse Source

A JUnit TestSuite can contain tests from multiple classes. In particular it

can contain tests from two different classes but with the same method
name.

Add a new classname attribute to the <testcase> element in the
XML report so that people know which test the report is talking about.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275144 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
3e2593fb20
3 changed files with 12 additions and 2 deletions
  1. +5
    -2
      WHATSNEW
  2. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java
  3. +4
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java

+ 5
- 2
WHATSNEW View File

@@ -548,10 +548,10 @@ Other changes:
<exec>'s manual page). Bugzilla Report 21877. <exec>'s manual page). Bugzilla Report 21877.


* <exec> will now have a new attribute spawn (default false). * <exec> will now have a new attribute spawn (default false).
If set to true, the process will be spawned. Bugzilla Report 5907.
If set to true, the process will be spawned. Bugzilla Report 5907.


* <java> will now have a new attribute spawn (default false). * <java> will now have a new attribute spawn (default false).
If set to true, the process will be spawned. Bugzilla Report 5907.
If set to true, the process will be spawned. Bugzilla Report 5907.


* <parallel> now supports a timeout which can be used to recover * <parallel> now supports a timeout which can be used to recover
from deadlocks, etc in the parallel threads. <parallel> also from deadlocks, etc in the parallel threads. <parallel> also
@@ -571,6 +571,9 @@ If set to true, the process will be spawned. Bugzilla Report 5907.
used to incrementally build an archive mixing compressed and uncompressed used to incrementally build an archive mixing compressed and uncompressed
entries. entries.


* <junit>'s XML formatter adds a new classname attribute to the <testcase>
elements.

Changes from Ant 1.5.3 to Ant 1.5.4 Changes from Ant 1.5.3 to Ant 1.5.4
=================================== ===================================




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

@@ -121,4 +121,7 @@ public interface XMLConstants {
/** value attribute for property elements */ /** value attribute for property elements */
String ATTR_VALUE = "value"; String ATTR_VALUE = "value";


/** classname attribute for testcase elements */
String ATTR_CLASSNAME = "classname";

} }

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

@@ -214,6 +214,10 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
currentTest = doc.createElement(TESTCASE); currentTest = doc.createElement(TESTCASE);
currentTest.setAttribute(ATTR_NAME, currentTest.setAttribute(ATTR_NAME,
JUnitVersionHelper.getTestCaseName(test)); JUnitVersionHelper.getTestCaseName(test));
// a TestSuite can contain Tests from multiple classes,
// even tests with the same name - disambiguate them.
currentTest.setAttribute(ATTR_CLASSNAME,
test.getClass().getName());
rootElement.appendChild(currentTest); rootElement.appendChild(currentTest);
testElements.put(test, currentTest); testElements.put(test, currentTest);
} else { } else {


Loading…
Cancel
Save