7.3 Adding Findbugs Report

compared with
Version 3 by Lubos Pochman
on Oct 06, 2008 00:03.


Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 7 changes. View first change.

 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].
  To add [Findbugs|http://findbugs.sourceforge.net/index.html] report, you only need two steps:
 # Generate Findbugs *XML* report from [Ant|http://ant.apache.org] or [Maven|http://maven.apache.org] or any other build tool.
 # Publish Findbugs report in the [configuration|1. Working with Configuration].
  
h2. Generate Cobertura Report
  h2. Generate Findbugs 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]:
 {code:xml|title=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>
  <fileset dir="${build.otherclasses.dir}">
  <include name="**/*.class" />
  <exclude name="**/*Test.class" />
  </fileset>
  </cobertura-instrument>
  </target>
  
  <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"
  destdir="${build.reports.dir}/coverage-xml"
  format="xml"
  >
  <fileset dir="${src.dir}">
  <include name="**/*.java" />
  </fileset>
  <fileset dir="${othersrc.dir}">
  <include name="**/*.java" />
  </fileset>
  </cobertura-report>
  
  <cobertura-check datafile="${build.dir}/cobertura.ser"
  totalbranchrate="50"
  totallinerate="50" />
  </target>
  QuickBuild will NOT generate [Findbugs|http://findbugs.sourceforge.net/index.html] report automatically, so first make sure the [Findbugs|http://findbugs.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 Findbugs test results with [Ant Findbugs task|http://findbugs.sourceforge.net/manual/anttask.html]:
 {code:xml|title=Findbugs report target in build.xml}
  <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.utils.dir}/findbugs-ant.jar"/>
  
  <target name="findbugs" depends="dist,findbugs-xml,findbugs-html"/>
  <target name="findbugs-xml">
  <mkdir dir="${findbugs.reports}"/>
  <findbugs home="${findbugs.home}"
  output="xml:withMessages"
  outputFile="${findbugs.reports}/findbugs.xml" jvmargs="-Xmx512m">
  <auxClasspath path="${lib.dir}" />
  <sourcePath path="${src.dir}" />
  <class location="${dist.dir}/${exe.name}.jar" />
  </findbugs>
  </target>
 {code}
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.
  The code snippet will generate the XML reports for each test case, and the reports will be captured to '$\{findbugs.reports\}' directory. *Note. The _output_ format should be set to 'xml:withMessages'.*
  
h2. Publish Cobertura Report
  h2. Publish Findbugs Report
  
Just like all other [build reports|07. Publish Build Reports], you add Cobertura report by [adding a publish step|Working With Step] in a [configuration|1. Working with Configuration]. When you add publish Cobertura Report step, the following screen will be displayed:
  Just like all other [build reports|07. Publish Build Reports], you add Findbugs report by [adding a publish step|Working With Step] in a [configuration|1. Working with Configuration]. When you add publish Findbugs Report step, the following screen will be displayed:
  
 !cobertura_step.png!
  !findbugs_step.png!
  
 In Source Pattern field, QuickBuild uses Ant style file patterns to collect the reports, and the directory you specified is *relative* to the [workspace|Workspace Directory] directory.