From 3e2593fb20bff8c6017e6b9462ccce4aaa65394a Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 27 Aug 2003 08:40:23 +0000 Subject: [PATCH] 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 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 --- WHATSNEW | 7 +++++-- .../tools/ant/taskdefs/optional/junit/XMLConstants.java | 3 +++ .../taskdefs/optional/junit/XMLJUnitResultFormatter.java | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 9b4408d17..9c7e4fdc2 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -548,10 +548,10 @@ Other changes: 's manual page). Bugzilla Report 21877. * 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. * 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. * now supports a timeout which can be used to recover from deadlocks, etc in the parallel threads. 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 entries. +* 's XML formatter adds a new classname attribute to the + elements. + Changes from Ant 1.5.3 to Ant 1.5.4 =================================== diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java index 32775252f..473044408 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java @@ -121,4 +121,7 @@ public interface XMLConstants { /** value attribute for property elements */ String ATTR_VALUE = "value"; + /** classname attribute for testcase elements */ + String ATTR_CLASSNAME = "classname"; + } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java index 865f493a6..ccda8f5ec 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java @@ -214,6 +214,10 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan currentTest = doc.createElement(TESTCASE); currentTest.setAttribute(ATTR_NAME, 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); testElements.put(test, currentTest); } else {