Clover

Information

Clover is a powerful and highly configurable code coverage analysis tool. It discovers sections of code that are not being adequately exercised by your unit tests.

Homepage: http://www.cenqua.com/clover/

Example

NOTE: the following example is for simple testing such as common components. See below for information about using Clover with J2EE applications.

It runs each unit test and produces a report of the paths through the actual code that the unit tests executed. To use the clover target, you need to set the properties described in the Common Build Targets document.

<target name="clover"> <ant antfile="$" target="CloverJ2EE"> <property name="html.title" value="A coverage report for myproject"/> <property name="report.dir" value="C:\temp\myproject"/> <property name="classes.dir" value="$\bin"/> <property name="source.dir" value="$\src"/> <property name="test.source.dir" value="$\test"/> </ant> </target> It will try to run a JUnit test suite class named com.mycompany.AllTests that should contain all of the tests to be run. It will not report on any *Test.java, *TestCase.java or AllTests.java classes as these are the actual test classes and the coverage is for the classes actually under test. A clover database will be created to C:\temp\cloverdb for the task to store data before making the report.

The project classpath is also needed, but this is found out by the GetClasspath task. The common target will add the directory clover to the report dir you provided and create a report with the name index.html.

Use with a J2EE application

See Using our build system for script examples on how to use Clover to help test J2EE applications. You will also need to configure WSAD in this case.

To use Clover to get the coverage results from the applications:


DeadEd.com
http://www.deaded.com/staticpages/index.php/clover