This documentation relates to QuickBuild 13.0.x
Select here if you are using a different version

Publish Cobertura Report

To publish Cobertura report, you only need two steps:

  1. Generate Cobertura XML report from Ant or Maven or any other build tool.
  2. Add Cobertura publish step by choosing Publish -> Cobertura Report from step menu.

The cobertura should be version 1.9.2 or higher.

Generate Cobertura Report

QuickBuild will NOT generate Cobertura report automatically, so first make sure the Cobertura report is produced by ANT or by any other build tool. The following example shows how to generate Cobertura test results with Ant Cobertura task:

Cobertura coverage report target in build.xml
<target name="instrument" depends="jar">
		<delete file="${basedir}/cobertura.ser" />
		<delete file="${build.dir}/cobertura.ser" />

		<cobertura-taskdef />

		<cobertura-instrument datafile="${build.dir}/cobertura.ser" todir="${build.instrumented.dir}">
		    <fileset dir="${build.classes.dir}">
		        <include name="**/*.class" />
		        <exclude name="**/*Test.class" />
				<exclude name="net/sourceforge/cobertura/javancss/*.class" />
		    <fileset dir="${build.otherclasses.dir}">
		        <include name="**/*.class" />
		        <exclude name="**/*Test.class" />

	<target name="coverage-report">
		<cobertura-taskdef />

		<delete dir="${build.reports.dir}/coverage-xml" />
		<mkdir dir="${build.reports.dir}/coverage-xml" />
		<cobertura-report datafile="${build.dir}/cobertura.ser"
			<fileset dir="${src.dir}">
				<include name="**/*.java" />
			<fileset dir="${othersrc.dir}">
				<include name="**/*.java" />

		<cobertura-check datafile="${build.dir}/cobertura.ser"
		                 totallinerate="50" />

The code snippet will generate the XML reports for each test case, and the reports will be captured to '${build.reports.dir}/coverage-xml' directory.

For property src.dir, should define like below:
instead of a relative path below:

otherwise, opening source code from QuickBuild may fail if basedir is different from workspace directory.

Publish Cobertura Report

Add Publish Cobertura Report step to your build workflow. If you have several report sets, you can add several steps with different report set names. Reference this page for more details.

Trouble Shooting

If you can not publish Cobertura reports correctly, please:

  1. Make sure you generate the Cobertura XML files. As by default, Cobertura only generate .ser file.
  2. Make sure your file pattern is specified correctly. For example, Cobertura maven goal will generate the Cobertura XML files to target/site/cobertura/coverage.xml and the pattern "**/target/*.xml" will not work, instead, you may need use pattern like "**/target/site/cobertura/*.xml".


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