Thursday, June 17, 2010

Generating a Junit Report for TestNG execution

Now a days everyone is using TestNG in place of Junit and as part of Selenium execution.

TestNg provides a lot of added features. One of the good thing it provides is test execution results in the form of XML. We can use this XML file for other type of report format generation. One of them is Junit reporting.

In this blog I will mention how to generate a Junit report for a TestNG execution.
Below ant target will generate the Junit report for the TestNG execution results.


In the above ant target you need to specify the path to the TestNG results xml file in the "dir" attribute under the "fileset" tag.

You need to mention the path where you want to generate the Junit report in the "todir" attribute under the "report" tag.

Also you can mention whether you want the Junit report with frames or without frames in the "format" attribute under the "report" tag.