UnitTH is a tool for generating a set of HTML test history pages from JUnit and TestNG test results.
There are two versions that can be downloaded, a Jenkins plugin or as a stand alone tool.
For Jenkins users there is a light version of the tool that provides the test failure matrix for a given job.
Installing
Download the latest plugin from here: https://sourceforge.net/projects/junitth/files/unitth-jenkins-plugin/. Then on the manage plugins page in Jenkins there is an Advanced tab, where you can upload the unitth plugin, no further configuration needed.
Using it
In the job configuration UnitTH will surface as a Post-build action, select it together with publish JUnit test results which generates the slimmed down XML needed that UnitTH parses the test history.
The results will then be available from the job sidebar.
For the test history report generated using the console it displays various different sortable test statistics, trends, graphs and references to the included JUnit test reports.
Input flags
Example:
$ java -jar unzippedToFolder/unitth.jar storedAwayReports/report∗
The properties set in the unitth.properties file can be overridden using system properties as exemplified below.
$ java -Dunitth.report.dir=<report to="" folder=""> -jar unzippedToFolder/unitth.jar storedAwayReports/report∗
</report>
The top three targets below shall be well known. Storing the test report and generating the test history targets might be new targets to implement. Below are examples for how these can be implemented.
Storing the test report
Create a simple target that copies away the latest generated test report. Use the same folder for all stored away test reports to make it simpler to point out which folders to use as input for the test history generation.
<target name="store.junit.report" description="Saves away the generated JUnit test report.">
<tstamp>
<format property="start.timestamp" pattern="yyyyMMdd-HHmmss">
</format></tstamp>
<copy todir="${reportStorage}/report-${start.timestamp}">
<fileset dir="report">
</fileset></copy>
</target>
Generating a test history
The generate.history target takes the input folders as a single argument. The rest of the test history generation parmeters will be picked up by the unitth.properties file in the current folder in $HOME.
<target name="generate.history" description="Generates a test history from existing Unit-reports.">
<java jar="${bin.dir}/unitth.jar" fork="true" failonerror="true" maxmemory="128m">
<arg value="${reportStorage}/report-*">
</arg></java>
</target>
The properties read from the unitth.properties can be overridden by defining system properties. Include the sysproperty in your ant target.
<-- Example where system properties are set -->
<target name="generate.history" description="Generates a test history from existing Unit-reports.">
<java jar="${bin.dir}/unitth.jar" fork="true" failonerror="true" maxmemory="128m"></java></target>
<sysproperty key="unitth.html.report.path" value=".">
<sysproperty key="unitth.report.dir" value="report.out">
<sysproperty key="unitth.generate.exectimegraphs" value="false">
<sysproperty key="unitth.xml.report.filter" value="TEST-"></sysproperty></sysproperty></sysproperty></sysproperty>
<arg value="${reportStorage}/report-*">
</arg>