Clover can be used with NetBeans 6.1 by integrating Clover for Ant into your NetBeans project build, which is Ant-based. This integration will allow seamless instrumentation, test execution and hard-copy coverage report generation from within NetBeans.
To start, download Clover for Ant at http://www.atlassian.com/software/clover/CloverDownloadCenter.jspa. Once you've downloaded Clover for Ant, expand it to a separate folder (referred to as
CLOVER_HOME). You'll also need a valid Clover license file, which you can obtain at http://www.atlassian.com/software/clover/.
1. Add Clover to the NetBeans Ant
1.1 Go to Preferences->Miscellaneous->Ant and use Add JAR/ZIP to add
CLOVER_HOME/lib/clover.jar to the classpath, you can also add
clover.license (or you can specify this in project's build.xml)
2. Create a new Clover Library
2.1 Open Tools/Libraries
2.2 Click "New Library..." and name it "Clover"
CLOVER_HOME/lib/clover.jar to the new library.
3. Use Add JAR/Folder to add
CLOVER_HOME/lib/clover.jar to the project classpaths
3.1 Open Project/Properties...
3.2 In Libraries add the Clover library to the Compile, Run, Compile tests, Run tests classpaths
4. Add Clover targets to the build
4.1 Add the following to the project
build.xml (go to Files view and edit this file)
5. Using Clover from within NetBeans
5.1 Perform a complete clean and rebuild of the project by selecting Build->Clean and Build Main Project...
5.2 Select the project
build.xml and run the
test target using the Ant Targets window
5.3 Run the
clover.report target to generate a Clover HTML report
clover.enable can be used to disable Clover integration
clover.reportdir can be used to control where the HTML report is generated
6. Extending the Clover integration
Because NetBeans uses a standard Ant-based build, you can use all of Clover's Ant tasks from your project build file. This allows you to control includes and excludes, set up source-level filters, change report formats and more. For an overview of the Clover Ant tasks, see http://confluence.atlassian.com/display/CLOVER/6.+Ant+Task+Reference