View Source

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.

h3. 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="" value="target/reports/test-reports"/>
<mkdir dir="${}" />
<mkdir dir="${}/test-out" />
<record name="${}/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="${}/test-out">
<fileset dir="${test.home}">
<include name="**/*"/>
<exclude name="**/*"/>

<!-- junitreport is not required here, but we recommend to add this to speed up the later publish step -->
<junitreport todir="${}">
<fileset dir="${}/test-out">
<include name="TEST-*.xml"/>
<record name="${}/test-output.txt" action="stop"/>

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 $\{\} correctly.

h3. 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:

h3. 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:
# master, this step is a serial composition step which contains all other steps and this step will run on server.
# checkout step, this step will check out the source code from the repository we defined and this step will run on server.
# Distribute Tests step, this step is defined as a parall composition step which contains our test step and this step will run on server.
# 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:
## 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.
## Publish JUnit Reports on Windows step, this step will publish the JUnit reports generated from previous step.
# 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:
## Build and Run Tests on Linux step
## 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_*