You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/06/18 11:36:07 UTC
DO NOT REPLY [Bug 45227] New: JUnit summary reports bogus running of
the last test after a timeout
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: notifications@ant.apache.org
ReportedBy: ben.rowlands@morganstanley.com
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.
DO NOT REPLY [Bug 45227] JUnit summary reports bogus running of the
last test after a timeout
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45227
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
DO NOT REPLY [Bug 45227] JUnit summary reports bogus running of the
last test after a timeout
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45227
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |1.8.0
--- Comment #2 from Stefan Bodewig <bo...@apache.org> 2008-08-11 06:51:47 PST ---
OK, this issue is tricky since Ant doesn't know how much information has
already been logged by some formatters (and it doesn't know which test caused
the timeout either).
I've modified the log output, you'd now get
[junit] Running tests.ATest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.125 sec
[junit] Running tests.BTest
[junit] Running tests.Batch-With-Multiple-Tests
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Tests FAILED (timeout)
Right now I don't see anything better we could do (short of changing the
formatter infrastructure).
svn revision 684745
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
DO NOT REPLY [Bug 45227] JUnit summary reports bogus running of the
last test after a timeout
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45227
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
Target Milestone|1.8.0 |1.8.2
--- Comment #4 from Stefan Bodewig <bo...@apache.org> 2010-10-25 10:35:41 EDT ---
the logic of determining the package name was obviously broken in 1.8.0 and
1.8.1.
fixed with svn revision 1027142
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
DO NOT REPLY [Bug 45227] JUnit summary reports bogus running of the
last test after a timeout
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45227
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |notifications@ant.apache.org
AssignedTo|notifications@ant.apache.org|bodewig@apache.org
--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2008-08-08 06:50:58 PST ---
confirmed, see disabled testcase in svn revision 683965
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.
DO NOT REPLY [Bug 45227] JUnit summary reports bogus running of the
last test after a timeout
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45227
--- Comment #3 from Ivan Kronkvist <ik...@yahoo.com> 2010-10-06 13:51:11 EDT ---
The fix, below, only tales the first part of the package name. For instance if
my package is org.apache.junit.tests.MyTest, the output displayed will be
[junit] Running org.Batch-With-Multiple-Tests
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Tests FAILED (timeout)
And thus still leads to a wild-goose chase. Much better solution is to find tha
last "." in the test name so the real package can be displayed.
private static JUnitTest createDummyTestForBatchTest(JUnitTest test) {
JUnitTest t = (JUnitTest) test.clone();
int index = test.getName().indexOf(".");
// make sure test looks as if it was in the same "package" as
// the last test of the batch
String pack = index > 0 ? test.getName().substring(0, index + 1) : "";
t.setName(pack + NAME_OF_DUMMY_TEST);
return t;
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.