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 2013/12/13 12:15:44 UTC

[Bug 55879] New: formatter doesn't log stdout messages unless Test Suite is completed

https://issues.apache.org/bugzilla/show_bug.cgi?id=55879

            Bug ID: 55879
           Summary: formatter doesn't log stdout messages unless Test
                    Suite is completed
           Product: Ant
           Version: 1.9.2
          Hardware: PC
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: michael.suedkamp@docware.de

We had the problem that a JUnit test hung due to a very simple reason (issue
with database connection). We would have found the reason very quickly if all
stdout messages would be logged immediately when they occur.
However, the Ant Junit task will not log any stdout message unless the test
suite is finished, which actually never happens for a 'hang' situation. This
requires guessing the reason. I also tried already to derive my own formatter
from JUnitResultFormatter, but realized that this restriction comes from the
base class (at least in my understanding).

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55879] formatter doesn't log stdout messages unless Test Suite is completed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55879

--- Comment #2 from michael.suedkamp@docware.de ---
As I tried to explain, I already tried to write my own class that implements
JUnitResultFormatter (like the PlainJUnitResultFormatter). There are some
sample implementations around but none spots immediate log flushing. The
earliest time to log things I found was in the endTest() method. But the out
stream I assigned in setSystemOutput() was always empty there. Only
endTestSuite() contained a non empty out stream - but this would be then like
PlainJUnitResultFormatter.

Maybe I'm missing something.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55879] formatter doesn't log stdout messages unless Test Suite is completed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55879

--- Comment #3 from michael.suedkamp@docware.de ---
Recently I found the JUnit task option "showoutput". When set to "true" I see
the expected output on the console. Without this option only a brief test
summary was logged there.

Actually, that's what I needed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55879] formatter doesn't log stdout messages unless Test Suite is completed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55879

Michael Clarke <mc...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mclarke@apache.org

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55879] formatter doesn't log stdout messages unless Test Suite is completed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55879

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #4 from Stefan Bodewig <bo...@apache.org> ---
Thanks Michael

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55879] formatter doesn't log stdout messages unless Test Suite is completed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55879

Antoine Levy-Lambert <an...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.9.2                       |1.9.3

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55879] formatter doesn't log stdout messages unless Test Suite is completed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55879

Michael Clarke <mc...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Michael Clarke <mc...@apache.org> ---
This is caused by the PlainJUnitResultFormatter not calling flush following
each print, although that in itself isn't a bad thing as it prevents blocking
on every action whilst any underlying output stream is flushed.

You can overcome this if you want by duplicating the PlainJUnitResultFormatter
and calling flush after each write or writeln, or by creating a wrapper that
intercepts the setOuput and setError calls and either flushes them on timer, or
also intercepts the various reporting calls and calling flush on the output
streams after calling the original (super) reporting methods.

-- 
You are receiving this mail because:
You are the assignee for the bug.