aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes how to customize junit reports? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "how to customize junit reports?" Watch "how to customize junit reports?" New topic
Author

how to customize junit reports?

Rakesh Khob
Greenhorn

Joined: Jul 03, 2011
Posts: 9
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

Joined: May 26, 2003
Posts: 31057
    
232

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Rakesh Khob
Greenhorn

Joined: Jul 03, 2011
Posts: 9
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

Joined: May 26, 2003
Posts: 31057
    
232

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

Joined: Jul 03, 2011
Posts: 9
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

Joined: Jul 08, 2011
Posts: 2
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

Joined: Jul 03, 2011
Posts: 9
Hi Leo,
did you try editing .xsl file?
Leo Fc
Greenhorn

Joined: Jul 08, 2011
Posts: 2
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to customize junit reports?