File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to customize junit reports?

 
Rakesh Khob
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating junit report using ant task <junitreport>.
Is there a way to make some ant property task value(for ex: <property name=some_name value=some_value/>) appear in the junit reports?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33671
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rakesh,
Welcome to CodeRanch!

Not automatically. You could write your own logic to add the property after the report is generated though. It's just HTML. Or even generate your report from the XML - that would be more work though and only if you had a major customization.
 
Rakesh Khob
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jeanne for your reply.
The html file that is created from junitreport task, to customize it I guess I'll have to edit junit-frames.xsl
How exactly can I access the value attribute of property task in this .xsl file?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33671
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not necessarily. If I was only making one small change to the junit report, I'd use Ant to update the HTML file after it is generated by junitreport. This technique sounds easier in your case as well.
 
Rakesh Khob
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Thank you very much Jeanne.
I made the changes in the HTML file through ant and it worked the way I wanted.
thank you.
 
Leo Fc
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to achive the same thing (get a custom JUnit report). However, considering the variable info that I am trying to add in the JUnit report, I don't really want to do it by modifying the HTML with an ANT task. My intention is to add, somehow in the JUnit XML report, additinal tags/nodes (one or more depending on the test run).

I've read a post where suggest using System.out to print lines and they are going to be available in the XML report. However, it is not helpfull since they are not being displayed as additional tags in the xml report.

Once I have the XML report with the custom tags, I am going to use XSLT ANT task to generate a custom HTML report which is going to consider the info from the additional tags and they are going to be displayed in the report as new conlumns or as links to some other resources (depending on the test that is being run).

Is there a way to achieve this? Any other ideas? Please need help

Thanks,
Leo
 
Rakesh Khob
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leo,
did you try editing .xsl file?
 
Leo Fc
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rakesh,

Thanks for your quick reply.

I think editing/creating the .XSL file is the next step. First I need to have the XML with the additional/custom tags/nodes that stores the additional info that I need to display in the report.

Thanks,
Leo
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic