Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

Is there a way to (easily) generate an HTML report that contains the results of the test? I am currently using JUnit in addition to Selenium for testing web apps UI.

PS: Given the project structure I am not supposed to use Ant sad

1 Answer

0 votes
by (62.9k points)

 You can easily do this via ant. Here is a build.xml file for doing this

 <project name="genTestReport" default="gen" basedir=".">


                Generate the HTML report from JUnit XML files



        <target name="gen">

                <property name="genReportDir" location="${basedir}/unitTestReports"/>

                <delete dir="${genReportDir}"/>

                <mkdir dir="${genReportDir}"/>

                <junitreport todir="${basedir}/unitTestReports">

                        <fileset dir="${basedir}">

                                <include name="**/TEST-*.xml"/>


                        <report format="frames" todir="${genReportDir}/html"/>




This will identify the files with the format TEST-*.xml and create a test report with results into a folder named unitTestReports.

To run this (say the name of the above file is createTestReports.xml) run the following command in the terminal:

ant -buildfile createTestReports.xml

Browse Categories