Bug 35634 - junit task timeout fails to write log information to xml and brief formatters
Summary: junit task timeout fails to write log information to xml and brief formatters
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.7.0
Hardware: PC All
: P2 normal with 2 votes (vote)
Target Milestone: 1.7.1
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-06 20:13 UTC by Brian Fitzpatrick
Modified: 2008-12-19 08:07 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Fitzpatrick 2005-07-06 20:13:41 UTC
When a <junit> timeout occurs, the formatter log files do not contain the logs
of the test, though if you use "showoutput=true" the logs are visible on the
console.

If I have a formatter set up for the <junit> task and a timeout occurs during a
test execution, then the log output of the test does not appear in the formatter
text file.  However, if I specify "showoutput=true" in the <junit> task, then
the output of the test appears in the console.

<junit
	printsummary="true"
	fork="true"
	dir="${ecm.basedir}"
	haltonfailure="true"
	failureproperty="test.failed"
	timeout="600000"
	maxmemory="1024m"
	showoutput="${junit.showoutput}">

	<formatter type="brief" />
	<formatter type="xml" />

If a timeout occurs after 10 minutes, the *.TXT and *.XML files of the formatter
do not contain any log output. They only have a couple of lines indicating that
a timeout occurred.

However, if I set showoutput to true, then the console contains all of the
logging data of the test prior to the timeout, which makes it much easier to
figure out why the test timed out.

In our case, we use the MailLogger to send out the log, so we can't have all the
output going to the console, since it grows too large to be sent via e-mail.

The doc for the showoutput attribute indicates that it should be the same data
that goes to the formatters:

Showoutput - Send any output generated by tests to Ant's logging system as well
as to the formatters. By default only the formatters receive the output.
Comment 1 Clement MATHIEU 2007-07-17 05:59:42 UTC
hi,

This issue is still present in ant 1.7.0. 
If the timeout is reached, or if the VM exits by its own, logs are displayed on
the console but are not printed by the XML formatter. 

How an user is supposed to understand why a test had crashed if logs are lost ? :-)
Comment 2 Steve Loughran 2007-12-09 14:40:33 UTC
This is a known issue of the fact that the XML format includes summary
attributes on the root element; the test result formatter builds up a DOM in
memory and saves it on success.

when the JVM is killed, no file, so no diagnostics.

a brand new XML format would fix this, but there's no easy way to do an
stream-to-disk version of the current format.

What we could do is add an option to save the (incomplete) DOM to disk after
every test. This is something you could turn on with a java property in the test
process. It would make big test runs slower, but let people diagnose what the
last test that finished was, and from that, infer what went wrong. 
Comment 3 Ed Randall 2008-01-02 02:29:38 UTC
I'm finding that, when using <junit> with a timeout and <batchtest>, if the
timeout occurs there is no output written to the XML results file at all.

The test does not then appear in the subsequent junitreport.

As a result of this nobody noticed that a dozen or so of our tests were never
being executed due to a timeout.

A fix or workaround for this whould be highly appreciated.
Comment 4 Stefan Bodewig 2008-12-19 08:07:05 UTC
I think this has been fixed as a side effect of fixing bug 39946.

In either case, svn revision 728058 contains testcases for this and they path with trunk as well as Ant 1.7.1.