3

I have a Junit process that runs a bunch of data integrity tests every night, and I would like to have it email the results in a nicely formatted HTML email. The issue is the HTML formatter built into JUnit uses frames and an external stylesheet so it is not appropriate for email. The plain formatter has the results buried in the midst of a bunch of otherwise worthless data.

I thought it would be simple to find a XSLT stylesheet that formatted the XML output into an email-friendly format, but after a couple hours of googling, I have not been able to find one. If any of you have a email-friendly Junit formatter, I'd be eternally grateful.

John P
  • 1,540
  • 2
  • 22
  • 34
  • @Dimitre: Besides JUnit default stylesheet use some extension elements, this is an XSLT question. You could say it's a very specific one like... http://stackoverflow.com/questions/299235/convert-xhtml-to-word-ml as example. If Jhon P post some input sample for JUnit XML output, maybe someone would use a lot of free time to write some stylesheet... –  Sep 08 '10 at 21:46
  • @Alejandro: I retagged it, because I didn't want to vote to close it. As of now this question is quite incomplete and thus isn't a real question. Any question in this tag that lacks either or both source XML document and/or desired result is incomplete. – Dimitre Novatchev Sep 08 '10 at 21:54
  • @Dimitre: I completely agree with you: this is a question that has hardly answer. –  Sep 08 '10 at 22:34
  • @Dimitre: I found an option on the junitreport task that will compile the test results into a single html file using junit-noframes.xsl. The problem is it sticks all the – John P Sep 09 '10 at 15:05

2 Answers2

1

From http://ant.apache.org/manual/Tasks/junitreport.html

Ant assumes the following concerning the frames and noframes formats :

The frames format uses a stylesheet which is generating output only by redirecting.

The noframes format does not use redirecting and generates one file called junit-noframes.html.

Custom versions of junit-frames.xsl or junit-noframes.xsl must adhere to the above conventions.

Edit: The only web aviable source in here

  • The noframes option is close to what I'm looking for, but since it still sticks all the style information up in the tag, most web email clients ignore it and display the results unstyled. I'll use the junit-noframes.xsl as a starting point then and just build it custom. – John P Sep 09 '10 at 15:01
  • @John P: Good practice (CSS vs inline @style) looks like it makes your task harder. But even M$ Outl**k can handle this HTML format... –  Sep 09 '10 at 15:28
0

Use the one that Ant's <junitreport> to create the HTML report and email that.

duffymo
  • 305,152
  • 44
  • 369
  • 561