0 votes
1 view
in Devops and Agile by (19.8k 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 (63.4k points)

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

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

        <description>

                Generate the HTML report from JUnit XML files

        </description>

 

        <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"/>

                        </fileset>

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

                </junitreport>

        </target>

</project>

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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...