Menu

Home

UnitTH

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.

UnitTH Jenkins plugin

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.

  • As Post-build actions
    1. Configure Publish JUnit test results
    2. Enable UnitTH

The results will then be available from the job sidebar.

UnitTH as a standalone tool

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.

Using UnitTH from the console

  • Unzip the downloadable zip-file
  • Copy the unitth.properties file to $HOME or to the folder from where to execute UnitTH
  • Set the correct settings in the unitth.properties files
  • Run the jar file taking a set of JUnit test report folders as input (XML format)

Input flags

  • -h --help Shows the UnitTH help.
  • -v --version Shows the UnitTH version.

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>

Integrating UnitTH with Ant scripts

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.

  • build
  • test
  • generate test report
  • store test report
  • generate test history report

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>

Downloads