You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2001/07/08 05:51:47 UTC

[Bug 2499] New: - A timeout failure does not generate any xml output

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2499

*** shadow/2499	Sat Jul  7 20:51:47 2001
--- shadow/2499.tmp.11269	Sat Jul  7 20:51:47 2001
***************
*** 0 ****
--- 1,103 ----
+ +============================================================================+
+ | A timeout failure does not generate any xml output                         |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 2499                        Product: Ant                     |
+ |       Status: NEW                         Version: 1.3                     |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: Windows NT/2K           |
+ |     Priority: Other                     Component: Optional Tasks          |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: ant-dev@jakarta.apache.org                                   |
+ |  Reported By: Scott_Stark@displayscape.com                                 |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ If I use the junit task with a timeout and the unit test task
+ exceeds the timeout value, the ant prints a failure msg but
+ there is no failure status dumped to the xml log of the unit
+ test. Here is an example:
+ 
+ 
+ Apache 939>ant
+ Buildfile: build.xml
+ 
+ build:
+ 
+ run:
+     [junit] Running TestTimeout
+ 
+ BUILD FAILED
+ 
+ D:\usr\local\Java\Apache\build.xml:25: Test TestTimeout failed
+ 
+ Total time: 11 seconds
+ Apache 940>ls -l TEST-TestTimeout.xml
+ -rw-r--r--   1 Administ Administ        0 Jul  7 17:32 TEST-TestTimeout.xml
+ 
+ // build.xml
+ <?xml version="1.0"?>
+ 
+ <project name="UnitTests" default="run" basedir=".">
+     <property name="ant.dir" value="jakarta-ant-1.3" />
+ 
+     <!-- The base classpath for the junit tests -->
+     <path id="test.classpath">
+         <pathelement path="." />
+         <pathelement path="${ant.dir}/lib/ant.jar" />
+         <pathelement path="${ant.dir}/lib/crimson.jar" />
+         <pathelement path="${ant.dir}/lib/optional.jar" />
+         <pathelement path="${ant.dir}/lib/junit.jar" />
+     </path>
+ 
+     <target name="build">
+         <available property="junit.present" 
+ classname="junit.framework.TestCase" />
+         <javac srcdir=".">
+            <include name="TestTimeout.java" />
+         </javac>
+     </target>
+ 
+     <target name="run" depends="build">
+         <junit printsummary="yes" haltonfailure="yes" fork="true"
+             timeout="10000"
+         >
+             <classpath>
+                 <path refid="test.classpath" />
+             </classpath>
+             <formatter type="xml" usefile="true" />
+ 
+             <test name="TestTimeout" />
+         </junit>
+     </target>
+ </project>
+ 
+ // TestTimeout.java
+ import junit.framework.TestCase;
+ import junit.framework.TestSuite;
+ 
+ public class TestTimeout extends TestCase
+ {
+     public TestTimeout(String name)
+     {
+         super(name);
+     }
+ 
+     protected void setUp() throws Exception
+     {
+     }
+ 
+     public void testSleep() throws Exception
+     {
+        Thread.currentThread().sleep(15*1000);
+     }
+ 
+     public static void main(java.lang.String[] args)
+     {
+         System.setErr(System.out);
+         TestSuite suite = new TestSuite(TestTimeout.class);
+         junit.textui.TestRunner.run(suite);
+     }
+ 
+ }