Skip to main content
Version: QB70

Publish Reports

In Quickbuild (from Version 2.0), if we want to publish reports, we need add a publish step. Below gives an example for publishing JUnit reports, for other reports supported by Quickbuild, they are almost the same.

JUnit Tests with Ant

Quickbuild will not generate the original reports. Most of the reports should be generated by your build tools, such as Ant, Maven, NAnt, etc. In our example, we will generate JUnit by Ant, we will add a target in our build.xml:

<target name="junit" depends="compile">
<property name="junit.report.dir" value="target/reports/test-reports"/>
<mkdir dir="${junit.report.dir}" />
<mkdir dir="${junit.report.dir}/test-out" />
<record name="${junit.report.dir}/test-output.txt" append="no" action="start"/>

<!-- NOTE: haltonfailure set to NO or else the Ant will failed -->
<junit printsummary="yes" haltonfailure="no" 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 is not required here, but we recommend to add this to speed up the later publish step -->
<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>

Here, we need notice that for most of the reports generation task, the 'haltonfailure' or something like this property should be set to no, or else the target for Ant or other build tools will stop. If we want to publish the full reports, it is recommended to set this kind of property to 'no'.

Now, we can test our build script from command line, and make sure the script can generate the test reports to directory ${junit.report.dir} correctly.

Publish JUnit Report

In Quickbuild, now we will add a configuration for our project. After add the configuration, we will add some steps to build and test our project. The steps we added in Quickbuild may look like:

First, we will use all default settings and fill in the required fields for those steps. The Publish JUnit Step may looks like:

Here, we only tell Quickbuild where to find the original reports by filling in field Report Files/Patterns. The directory we write here is the same as we specified in build.xml.

Ok, we can run the configuration now to see the results now. In my example, after running the configuration, we will find an overview section for JUnit will be displayed and a JUnit Report tab is also added on the left side:

By clicking the 'JUnit Report' tab on the left side, four child tabs will be displayed:

Distribute JUnit Tests

Sometimes, we will run our tests on different platform to make sure our product can support all of them. In this case, Quickbuild supports to publish those reports separately and display the reports via different report sets.

Below screen shot shows after we add the steps supported for such case:

Here, we defined below steps:

  1. master, this step is a serial composition step which contains all other steps and this step will run on server.
  2. checkout step, this step will check out the source code from the repository we defined and this step will run on server.
  3. Distribute Tests step, this step is defined as a parall composition step which contains our test step and this step will run on server.
  4. Windows Composition step, this step is a serial composition step which will run on a Windows node, this step need transfer the resources from parent node(because all the source files are checked out on server node) and this step contains:
    1. Build and Run Tests on Windows step, this step is an Ant step which will build the source code and run junit task for testing on windows.
    2. Publish JUnit Reports on Windows step, this step will publish the JUnit reports generated from previous step.
  5. Linux Composition step, this step is same as Windows Composition step except that the step will run on a Linux node and this step also contains two child steps:
    1. Build and Run Tests on Linux step
    2. Publish JUnit Reports on Linux step

The below screen shots shows how we define these steps:
Windows Composition Step

Publish JUnit Reports On Windows Step