6.1 Adding JUnit Report

You are viewing an old version (v. 25) of this page.
The latest version is v. 47, last edited on Jan 19, 2010 (view differences | )
<< View previous version | view page history | view next version >>

To add JUnit report, you only need two steps:

  1. Generate JUnit XML report from Ant or Maven or any other build tool.
  2. Publish JUnit report in the [configuration].

Generate JUnit Report

QuickBuild will NOT generate JUnit report automatically, so first make sure the JUnit report is produced by ANT or by any other build tool. The following example shows how to generate JUnit test results with Ant JUnit task and aggregate all the test reports into one by using Ant JUnitReport task:

JUnit target in build.xml
<target name="junit" depends="compile.test">
    <mkdir dir="${junit.report.dir}" />
    <mkdir dir="${junit.report.dir}/test-out" />
    <record name="${junit.report.dir}/test-output.txt" append="no" action="start"/>
    <junit printsummary="yes" haltonfailure="yes" fork="yes">
        <classpath refid="test.classpath"/>
        <formatter type="xml"/>
        <batchtest fork="yes" todir="${junit.report.dir}/test-out">
            <fileset dir="${test.home}">
                <include name="**/*Test.java"/>
                <exclude name="**/*AbstractTest.java"/>
            </fileset>
        </batchtest>
    </junit>
    <junitreport todir="${junit.report.dir}">
        <fileset dir="${junit.report.dir}/test-out">
            <include name="TEST-*.xml"/>
        </fileset>
    </junitreport>
    <record name="${junit.report.dir}/test-output.txt" action="stop"/>
</target>

The code snippet will generate the XML reports for each test case, and the reports will be captured to '${junit.report.dir}' directory.

Publish JUnit Report

Just like all other [build reports], you add JUnit report by [adding a publish step] in a [configuration]. When you add publish JUnit Report step, the following screen will be displayed:

In source files field, QuickBuild uses Ant style file patterns to collect the reports, and the directory you specified is relative to the [workspace] directory.

More on JUnit Report

The default JUnit plugin setting only accepts the reports which have been aggregated by using 'junitreport' task.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.