3. 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 tools that support this type of build are AntHill, Bamboo and CruiseControl.

Clover supports this scenario with the following features:

Detailed coverage reports for the whole team


The <clover-html-report> and the <clover-pdf-report> tasks used here are simplified versions of the <clover-report> task. If you require more control over your report formatting and structure, use the <clover-report> task.

In this example, the <clover-html-report> task is used to generate source-level coverage reports in HTML format that can be published for viewing by the whole team:

<target name="clover.report" depends="with.clover">
   <clover-html-report outdir="clover_html"/>

Executive summary coverage reports

In this example, the <clover-pdf-report> task is used to generate summary reports in PDF format, suitable for email or audit purposes.

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


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 collated 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"/>

   <!-- generate a report with both current and historical data -->

   <clover-html-report outdir="clover_html"


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"

   <clover-pdf-report outfile="coverage.pdf"/>

   <mail from="nightlybuild@somewhere.not"
      subject="coverage criteria not met"

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

最終更新日 2016 年 5 月 30 日


Powered by Confluence and Scroll Viewport.