ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r568703 - /ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
Date Wed, 22 Aug 2007 17:07:59 GMT
Author: peterreilly
Date: Wed Aug 22 10:07:58 2007
New Revision: 568703

URL: http://svn.apache.org/viewvc?rev=568703&view=rev
Log:
Change firing of starttest event.
Original code assumed that a targetstart event
would always happen. However, this is not the case
if the target depends on a SetUp target that fails.
In this case the resultant xml result file was malformed.
This change always fires a starttest event, matching
the endtest event which is always send (from a finally block).

Modified:
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java

Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?rev=568703&r1=568702&r2=568703&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java (original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Wed Aug 22 10:07:58
2007
@@ -243,6 +243,7 @@
                     v.add(name);
                     LogCapturer lc = new LogCapturer(newProject);
                     try {
+                        fireStartTest(name);
                         newProject.executeTargets(v);
                     } catch (AssertionFailedException e) {
                         fireFail(name, e);
@@ -406,6 +407,18 @@
     }
 
     /**
+     * invokes start on all registered test listeners.
+     * @param targetName the name of the target.
+     */
+    private void fireStartTest(String targetName) {
+        Iterator it = listeners.iterator();
+        while (it.hasNext()) {
+            AntUnitListener al = (AntUnitListener) it.next();
+            al.startTest(targetName);
+        }
+    }
+
+    /**
      * invokes addFailure on all registered test listeners.
      * @param targetName the name of the failed target.
      * @param ae the associated AssertionFailedException.
@@ -464,10 +477,6 @@
             a.endTestSuite(event.getProject(), buildFile);
         }
         public void targetStarted(BuildEvent event) {
-            String tName = event.getTarget().getName();
-            if (tName.startsWith(TEST)) {
-                a.startTest(tName);
-            }
         }
         public void targetFinished(BuildEvent event) {
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message