Home | Clover | Clover.NET | FishEye | Support | Account | Download | Buy Now

Using Clover in Automated Builds

In this scenario, the project is checked out, built and tested at regular intervals, usually by an automated process. Some third party tools that support this type of build are AntHill, Centipede and CruiseControl.

Clover supports this scenario with the following features:

Detailed coverage reports for the whole team

The <clover-report> task generates source-level html coverage reports that can be published for viewing by the whole team:

<target name="clover.report" depends="with.clover">
   <clover-report>
      <current outfile="clover_html">
         <format type="html"/>
      </current>
   </clover-report>
</target>

Executive summary coverage reports

The <clover-report> task can generate summary reports in PDF suitable for email or audit purposes.

<target name="clover.summary" depends="with.clover">
   <clover-report>
      <current summary="yes" outfile="coverage.pdf">
         <format type="pdf"/>
      </current>
   </clover-report>
</target>

Historical coverage and project metrics reporting

Clover can generate a historical snapshot of coverage and other metrics for your project using the <clover-historypoint> task. Historical data can then be colated into a historical report using the <clover-report> task:

<target name="clover.report" depends="with.clover">

   <!-- generate a historypoint for the current coverage -->
   <clover-historypoint historyDir="clover_hist"/>

   <clover-report>

      <!-- generate a current report -->
      <current outfile="clover_html">
         <format type="html"/>
      </current>

      <!-- generate a historical report -->
      <historical outfile="clover_html/historical.html"
                  historyDir="clover_hist">
         <format type="html"/>
      </historical>
   </clover-report>
</target>

Coverage criteria checking and triggers

The <clover-check> task can be used to monitor coverage criteria. If coverage does not meet the criteria, the build can be made to fail or an arbitary activity can be triggered. In the example below, if project coverage is not 80%, an executive summary coverage report is generated and mailed to the team:

<target name="coverageAlert" depends="coverage.check"
         if="coverage_check_failure">
   <clover-report>
      <current summary="yes" outfile="coverage.pdf">
         <format type="pdf"/>
      </current>
   </clover-report>
   <mail from="nightlybuild@somewhere.not"
      tolist="team@somewhere.not"
      subject="coverage criteria not met"
      message="${coverage_check_failure}"
      files="coverage.pdf"/>
</target>

<target name="coverage.check" depends="with.clover">
   <clover-check target="80%"
                 failureProperty="coverage_check_failure"/>
</target>