Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
Extending JUnit Ant tasks

Extending JUnit Ant tasks

2007-06-10       - By Alex Ruiz
Reply:     1     2     3     4     5     6     7  

Hello all,

I've been trying to extend JUnit's report without success. The following are
some questions/comments about what I couldn't accomplish:

1. Ant's does
not offer any support for extensibility. It would be nice to have some
methods we could override to add some extra XML elements to the generated
XML report. For example, we can have the method 'protected void
onFailureOrError(Test test, Throwable error, Element errorElement)' which
can be overriden by users and add some extra elements to the XML element
containing the error information. Note that this method should not change
the behavior of XMLJUnitResultFormatter, it just lets users add extra
error/failure info.

2. In the same class it would be nice to have access to the XML document
(may be a protected getter?)

3. The method 'getTestCaseClassName(Test)' in '' is package
protected. Can it be changed to public?

4. I'm using my own XSL files for the junit report task. The problem is that
I need to hook up my own XSL extensions. This is what I have:

<xsl:stylesheet xmlns:xsl="" version="

and in the body of the XSL file I have:
   <xsl:value-of select="java:

and when running my Ant build I get the following:
[junitreport] Loading stylesheet
[junitreport] : Error! Cannot find class 'org.fest.swing.junit.ImageHandler
[junitreport] : Error! Cannot find external method '
org.fest.swing.junit.ImageHandler.decodeBase64AndSaveAsPng' (must be
[junitreport] : Fatal Error! Could not compile stylesheet

I haven't found a way to specify my own class in the junitreport tag. Any

Any help will be greatly appreciated!


©2008 - Jax Systems, LLC, U.S.A.