Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mail html junit reports in the message body using maven

 
Rakesh Khob
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rakesh Khob
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried finding a way to do that, but bad luck!
Can anyone suggest what I can do?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic