Bug 43582

Summary: Write log messages from test to AntUnit's log
Product: Ant Reporter: David Jackman <david.jackman>
Component: AntUnitAssignee: Ant Notifications List <notifications>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 1.0   
Target Milestone: 1.3   
Hardware: Other   
OS: other   
Attachments: Patch to implement this feature

Description David Jackman 2007-10-09 14:10:41 UTC
It is often difficult to see what's going on when running a test because the
output from the test isn't visible anywhere.  This enhancement is to have
AntUnit write the log messages from the test to the log of the AntUnit task. 
Since one does not normally want this output, I propose that all messages are
written as verbose-level messages, except for debug which are written as
debug-level.
Comment 1 David Jackman 2007-10-09 14:12:07 UTC
Created attachment 20948 [details]
Patch to implement this feature
Comment 2 Steve Loughran 2007-10-10 01:48:49 UTC
Makes sense. I normally just run the targets on their own to see the output, but
of course, that doesn't work if things behave differently under antunit

An extension for this would be to log everything at info on a test
failure...this could be good for builds under cruise control and gump, as you
get better remote diagnostics
Comment 3 David Jackman 2007-10-11 14:02:20 UTC
(In reply to comment #2)
> An extension for this would be to log everything at info on a test
> failure...this could be good for builds under cruise control and gump, as you
> get better remote diagnostics

For this sort of thing, it would be better for the reports generated by the
plain and XML listener to include the log output as well.  I've written this up
as bug 43604.
Comment 4 Stefan Bodewig 2007-12-05 08:49:29 UTC
I've faced the use case of somehow getting access to the log output of the
project under test before - see
http://mail-archives.apache.org/mod_mbox/ant-dev/200708.mbox/%3cy1ufy2u15ao.fsf@v30161.1blu.de%3e

I don't really want to modify the AntUnitListener interface, but I can
understand if we want to include it in the generated reports (since <junit> does
so) on the other hand.  Before we go into patch details, can we go back to the
dev list and agree on where we want the feature to go?
Comment 5 Stefan Bodewig 2008-04-08 03:44:37 UTC
Do you feel this is still required when the listener capture the log output?
Comment 6 David Jackman 2008-04-08 08:53:41 UTC
(In reply to comment #5)
> Do you feel this is still required when the listener capture the log output?

This has been helpful for us when running the tests manually (to see what's happening in the test as it's happening).  Having the listener capture the log output is helpful when the tests are run by an automated process.
Comment 7 Stefan Bodewig 2008-04-24 04:20:10 UTC
But you could simply attach a plainListener and have it log to to Ant's logging system.  I feel I must be missing something.
Comment 8 David Jackman 2008-04-24 09:23:23 UTC
(In reply to comment #7)
> But you could simply attach a plainListener and have it log to to Ant's logging
> system.  I feel I must be missing something.
> 

With the plainListener I can see the output from the tests after all the tests are run.  This change makes it possible for the person running the tests from the command line to see the output of the tests *while they are running*.  As you can see from the patch, it writes log messages from the test to the verbose level, so you would only see this output if you add the -verbose option to the command line.  (In practice, it would be better to allow some other command line option to specify whether AntUnit writes the log messages from the tests to the Ant log (not on verbose level) because adding the -verbose option always add so much other stuff to the log.)
Comment 9 Stefan Bodewig 2008-06-17 02:41:42 UTC
I must admit I still feel this would be too much in the light of plainlistener, maybe we can do a poll or something like this.
Comment 10 Stefan Bodewig 2014-05-02 16:41:25 UTC
AntUnit 1.3 will ship with a new listener named logforwarder which forwards the log from the project under test to the one running th test.

svn revision 1591967