ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 37241] New: - <junit> tasks that timeout do not perform tearDown if fork="true"
Date Tue, 25 Oct 2005 12:42:27 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37241>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37241

           Summary: <junit> tasks that timeout do not perform tearDown if
                    fork="true"
           Product: Ant
           Version: 1.6.5
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: wander@xs4all.nl


<junit> tests that timeout do not perform their teardown if fork is set to
"true", this can cause lots of trouble if database handles need to be closed or
servers need to be shut down in the teardown.

Consider the following junit test:

package org.example;
import junit.framework.TestCase;
public class TimeoutTest extends TestCase {

	public void setUp() {
		System.out.println("setUp");
	}

	public void tearDown() {
		System.out.println("tearDown");
	}

	public void testTimeout() {
		System.out.println("Test started");
		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			System.out.println("Interrupted!");
		}
		System.out.println("Test finished");
	}
}


And the following ant buildfile fragment:

<target name="test" depends="compile">
	<junit fork="yes" timeout="3000" showoutput="true">
		<classpath path="classes"/>
		<test name="org.example.TimeoutTest"/>
	</junit>
</target>



If run the test will timeout, the output on the console shows that the tearDown
method is never executed:
test:
    [junit] setUp
    [junit] Test started
    [junit] Test org.example.TimeoutTest FAILED (timeout)

If the timeout property in the buildfile is set to 6000 the test won't timeout
and the output on the console is:
test:
    [junit] setUp
    [junit] Test started
    [junit] Test finished
    [junit] tearDown

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message