Stefan, Steve, Paulo, and others interested,

Attached is a .zip file with my modifications for the JUnitReport task and
the MimeMail task.   Shall I post the patch difference files also so that
someone can commit these changes if they are acceptable?

Note - There has been a change since the 1.3 release to
XMLJUnitResultFormatter, but my code is built on the 1.3 codebase.

The MimeMail task that is attached is a modified version of Steve's task.
I've also included an HTML file in Ant-style describing its usage.   I added
the FileSet capability, and another attribute called 'messageFile' so that
the message body can be pulled either from the 'message' attribute or from
the file pointed to by 'messageFile'.   The handy thing about 'messageFile'
is that HTML files can be sent so that e-mail readers will recognize them
inline rather than as an attachment (but the messageMimeType must be
specified as "text/html" also).   This is nice when sending JUnitReport HTML
results.

I will address a few issues that have been brought up:

- Should we merge MimeMail and Mail?   It would be nice, but is unnecessary.
Its probably not a huge effort, but more effort than its worth since whoever
needs the MimeMail capability can just get the necessary .jar files and
<taskdef>.

- Should the other JUnitResultFormatters be modified to pick up the newly
added properties with the JUnitTask modification?   I looked at the
PlainJUnitResultFormatter, and did not want to mess with its output as
someone may be relying on it as-is, but its easy enough for any of these
formatters to be modified to grab these properties if desired.
startTestSuite(JUnitTest suite) and  endTestSuite(JUnitTest suite) both, of
course, have access to the JUnitTest and I added a method on JUnitTest
called getProperties that hands back a Properties object that contains the
name/value pairs.   Stefan proposed a different method to hand Properties
off to the formatters - I'm not sure what his proposed method gives us that
mine misses.

- As for Paulo's task - now that MimeMail has been modified to support
FileSet's there really isn't much difference except MimeMail has the
messageMimeType.   MimeMail seems to be more in line with the coding style
of the other Ant tasks.   I vote we stick with MimeMail and make that an
optional task.

- I've included the necessary XSL files to generate an overview of JUnit
tests.   I only modified overview-summary.xsl (but toolkit.xsl is needed in
the same directory).   I added the display of each test-suites properties -
and in IE5 the display of these properties can be toggled.   I didn't spend
a lot of time making this display of the properties really nice, but the
good thing is now that they are there in the XML its easy enough to do
something with them.  Let me know if you have any suggestions on how they
should be reported.

- This probably isn't behavior that can be relied upon, but by placing
JUnitMail.jar into my ANT_HOME/lib directory I'm able to <taskdef> MimeMail
and it works fine, as well as have my modified JUnitTask picked up in the
classpath prior to the one in optional.jar.   I'm assuming this is because
the loop in Ant.bat to add the lib .jar files is picking them up
alphabetically.   Will this work consistently on Windows and other platforms
in this manner if folks are using the wrapper scripts to start Ant?

Thanks again for everyones assistance,
    Erik

<<attachment: JUnitMail.zip>>

Reply via email to