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
org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter 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 '
org.apache.tools.ant.taskdefs.optional.junit.JUnitVersionHelper' 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="http://www.w3.org/1999/XSL/Transform"; version="
1.0"
   xmlns:lxslt="http://xml.apache.org/xslt";
   xmlns:redirect="http://xml.apache.org/xalan/redirect";
   xmlns:java="http://xml.apache.org/xslt/java";
   xmlns:stringutils="xalan://org.apache.tools.ant.util.StringUtils"
   extension-element-prefixes="redirect">

and in the body of the XSL file I have:
   <xsl:value-of select="java:
org.fest.swing.junit.ImageHandler.decodeBase64AndSaveAsPng(string($encoded.image),
string($screenshot.fullpath))"/>

and when running my Ant build I get the following:
[junitreport] Loading stylesheet
C:\fest\fest-swing-junit\src\main\java\org\fest\swing\junit\junit-frames.xsl
[junitreport] : Error! Cannot find class 'org.fest.swing.junit.ImageHandler
'.
[junitreport] : Error! Cannot find external method '
org.fest.swing.junit.ImageHandler.decodeBase64AndSaveAsPng' (must be
public).
[junitreport] : Fatal Error! Could not compile stylesheet

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

Any help will be greatly appreciated!

Thanks!
-Alex.

Reply via email to