aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes mail html junit reports in the message body using maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "mail html junit reports in the message body using maven" Watch "mail html junit reports in the message body using maven" New topic
Author

mail html junit reports in the message body using maven

Rakesh Khob
Greenhorn

Joined: Jul 03, 2011
Posts: 9
Hi,
I am using Maven-surefire-report plugin to generate junit test report and maven-postman-plugin for mailing these reports. In the mail body I am getting the report but not in the format(or template) in which it is generated.
Do I need to send css files also along with the html file? Or Is there any other method of achieving this?

Thanks!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5778
    
    7

So you are saying that the HTML mail you are sending relies on external CSS files to format the email properly? If so, the options I know of are:

a) Change the CSS reference to be full URLs to a location that the email recipients have access to. (Never tried this myself, but it should work.)

b) Change the HTML template to include the <style> section and place the CSS contents there. That way the HTML is self-sufficient. (This is what I would do.)

But wait a minute, are you saying that you send one of the Maven-generated report HTML files? And that that HTML file is relying on Maven-generate CSS files? Hmm, that's more difficult. I don't know how to send a directory structure of files within an email message. What I would do is publish the reports as a site for the project and email an URL to the surefire report on that site. Essentially that is what we do for our Hudson builds - people can ask for an RSS feed on a project and they get updates each time the project builds. The projects all generate web sites complete with unit tests reports.


JBoss In Action
Rakesh Khob
Greenhorn

Joined: Jul 03, 2011
Posts: 9
What will be the best way to include the CSS into the html file? The CSS and Html files are created as a part of surefire report generation.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5778
    
    7

Looking at the surefire report options (http://maven.apache.org/surefire/maven-surefire-report-plugin/report-mojo.html), there is no option to do this. Looks like if you want the style information to be embedded in the HTML page, rather than be in a separate file, you'll have to modify the surefire report plugin.
Rakesh Khob
Greenhorn

Joined: Jul 03, 2011
Posts: 9

I tried finding a way to do that, but bad luck!
Can anyone suggest what I can do?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mail html junit reports in the message body using maven
 
Similar Threads
[Maven] Nice HTML test-reports
where do i add the reporting tag so that i get the maven test reports generated in surefire reports
reports in html format
JUNITReport - Stack Overflow error
JUnit report