https://issues.apache.org/bugzilla/show_bug.cgi?id=45227
Summary: JUnit summary reports bogus running of the last test
after a timeout
Product: Ant
Version: 1.7.0
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Optional Tasks
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
The JUnit task used with fork="true", forkMode="perBatch" and a timeout (which
expires) incorrectly shows the last test was started in the summary log. This
leads to a Wild Goose chase trying to identify why the tests timed out!
* Steps to reproduce
Create a source folder with 4 tests classes in the package 'tests':
ATest, BTest, CTest, DTest
JUnit will run the tests in the given order. Test classes A, C and D contain a
single *empty* test method. Test class B contains a single test method that
sleeps *forever*. Configure the JUnit task as follows:
<junit fork="true" forkMode="perBatch" timeout="5000" printsummary="yes">
<batchtest>
<fileset dir="build">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
The JUnit task will log:
1. [junit] Running tests.ATest
2. [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.125 sec
3. [junit] Running tests.BTest
4. [junit] Running tests.DTest
5. [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
6. [junit] Tests FAILED (timeout)
Line 3 shows test B is run. The test will sleep forever after this point. A
spurious "Running tests.DTest" is printed on line (4) before the 'timeout' line
is printed.
The offending code is in JUnitTask. #executeAsForked() in invoked with the
*last* test in the batch from execute(List). This test is passed to
logTimeout() when the timeout occurs and finally into logVmExit() where it is
just logged. Its not clear why this is done when we are operating in batchTest
mode?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.