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 2009/09/28 23:32:02 UTC

DO NOT REPLY [Bug 47913] New: Allow to add one or more Junit RunListener instances in the Junit task

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

           Summary: Allow to add one or more Junit RunListener instances
                    in the Junit task
           Product: Ant
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Optional Tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: olivier.dupuy@pwgsc.gc.ca


Hello,

Not fond in the existing bugs or RFE.

I try to solve the following problem. We have some hundreds of unit tests
running. It happens that one of them takes a lot of time to run or is blocked.
In an IDE like Eclipse, I can see which test is running in the Junit window.
When I run the tests through the Junit task of Ant, I cannot. I have to wait
for the test report.

Junit provides a way to add one or more RunListener instances
(http://junit.sourceforge.net/javadoc_40/org/junit/runner/notification/RunListener.html)
to a JunitCore object. The Junit RunNotifier class allows also to add some
notifiers.
The problem is that I do not have any hook to do this at all while the runner
used by Ant has normally access to these classes. I even suppose that it
already takes advantage of them.

What I suggest is to add to the Junit task an optional attribute, which would
be a comma delimited list of listener FQN (or if you prefer a single one a one
could call others).
e.g.
<junit runlistener="com.acme.MyListener">
  ...
</junit>

With this I am free to do anything that I want, report a progress in one or
many log files, timing my tests, detect a problem and link it to a precise
test...

Thanks

Olivier

-- 
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 47913] Allow to add one or more Junit RunListener instances in the Junit task

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

olivier dupuy <ol...@pwgsc.gc.ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #3 from olivier dupuy <ol...@pwgsc.gc.ca> 2009-10-08 09:50:48 PDT ---
Hello,

I still want the output to be sent to the XML formatter as now.
I just want some additional behavior. I suppose that the plain formatter could
give some details but I do not want to run the unit tests twice, it takes
already long enough.

I just want some information during the tests that I can log where I want.
Multiple RunListeners can be used. I guess that you already use one of them for
your formatter. I just to want the option to add mine to the one of the
formatter.

The other option I now think of is to extend/decorate the XML formatter. This
could be fine but if I need to change to a different formatter for any reason,
I need to redo my work. The listener solution would be more flexible I think.  

Thanks

Olivier

-- 
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 47913] Allow to add one or more Junit RunListener instances in the Junit task

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

--- Comment #1 from olivier dupuy <ol...@pwgsc.gc.ca> 2009-09-28 14:34:19 PDT ---
...and with the FQN avaialble, the Junit runner can create an instance of it
and add it after the other listeners. It should to the trick.

Olivier

-- 
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 47913] Allow to add one or more Junit RunListener instances in the Junit task

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

J.M. (Martijn) Kruithof <jk...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #2 from J.M. (Martijn) Kruithof <jk...@apache.org> 2009-10-01 12:05:16 PDT ---
Could you please elaborate what is not feasible using the current options,
most notably the formatter element?

-- 
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 47913] Allow to add one or more Junit RunListener instances in the Junit task

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

olivier dupuy <ol...@pwgsc.gc.ca> changed:

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

--- Comment #6 from olivier dupuy <ol...@pwgsc.gc.ca> 2009-10-21 13:56:13 UTC ---
Hi Stefan,

I have just tested according to your suggestion, creating a class extending
BriefJUnitResultFormatter and decorating it to log the test being started or
other then putting it in a jar file added to the classpath.
It works perfectly, I can now see the progress of the tests.

Thanks a lot, I had not realized from the documentation that multiple
formatters could be used.
I close the request
Olivier

-- 
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 47913] Allow to add one or more Junit RunListener instances in the Junit task

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #5 from Stefan Bodewig <bo...@apache.org> 2009-10-21 11:54:36 UTC ---
It really seems as if all the functionality you are asking for is already there
(use multiple formatters).  What is missing?

-- 
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 47913] Allow to add one or more Junit RunListener instances in the Junit task

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

--- Comment #4 from Stefan Bodewig <bo...@apache.org> 2009-10-09 01:07:59 PDT ---
Olivier, do you realize that you can add more than one formatter element to the
junit task and thus can add more than one formatter during a single test run?

And then formatter supports a classname attribute that you can use to attach
any class that implements the JUnitResultFormatter interface (an extension of
junit-framework.TestListener) to the running tests.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.