7.6 Adding Cobertura Report

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

To add [Cobertura|http://cobertura.sourceforge.net/index.html] report, you only need two steps:
# Generate Cobertura *XML* report from [Ant|http://ant.apache.org] or [Maven|http://maven.apache.org] or any other build tool.
# Publish Cobertura report in the [configuration|1. Working with Configuration].

Generate Cobertura Report

QuickBuild will NOT generate [Cobertura|http://cobertura.sourceforge.net/index.html] report automatically, so first make sure the [Cobertura|http://cobertura.sourceforge.net/index.html] report is produced by [ANT|http://ant.apache.org] or by any other build tool. The following example shows how to generate Cobertura test results with [Ant Cobertura task|http://cobertura.sourceforge.net/anttaskreference.html]:

Cobertura target in build.xml
<target name="junit" depends="compile.test">
&nbsp;&nbsp;&nbsp; <mkdir dir="${junit.report.dir}" />
&nbsp;&nbsp;&nbsp; <mkdir dir="${junit.report.dir}/test-out" />
&nbsp;&nbsp;&nbsp; <record name="${junit.report.dir}/test-output.txt" append="no" action="start"/>
&nbsp;&nbsp;&nbsp; <junit printsummary="yes" haltonfailure="yes" fork="yes">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <classpath refid="test.classpath"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <formatter type="xml"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <batchtest fork="yes" todir="${junit.report.dir}/test-out">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <fileset dir="${test.home}">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <include name="**/*Test.java"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <exclude name="**/*AbstractTest.java"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </fileset>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </batchtest>
&nbsp;&nbsp;&nbsp; </junit>
&nbsp;&nbsp;&nbsp; <junitreport todir="${junit.report.dir}">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <fileset dir="${junit.report.dir}/test-out">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <include name="TEST-*.xml"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </fileset>
&nbsp;&nbsp;&nbsp; </junitreport>
&nbsp;&nbsp;&nbsp; <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|07. Publish Build Reports], you add JUnit report by [adding a publish step|Working With Step] in a [configuration|1. Working with Configuration]. When you add publish JUnit Report step, the following screen will be displayed:

!junit_step.png!

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

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