Clover Code Coverage for Grails

  • Tags : testing, coverage, reporting
  • Latest : 3.1.11
  • Last Updated: 26 March 2013
  • Grails version : 1.3.* > *
2 votes
Dependency :
compile ":clover:3.1.11"
Custom repositories :
mavenRepo "https://maven.atlassian.com/public/"
mavenRepo "https://maven.atlassian.com/public-snapshot/"

Documentation

Summary

A plugin that integrates Clover into GRAILS projects. Clover is a Code Coverage tool that produces beautiful reports which are highly configurable and extensible. Clover not only reports which lines of code were executed during a test run, it also reports which tests hit which lines of code. Clover's reports include: Tag Clouds of your entire project that compare Complexity with Coverage A TreeMap to visualise the most complex, uncovered areas of your project Fully Cross Referenced HTML view of your source code Much more: See http://atlassian.com/clover

Installation

Getting started with Clover for Grails is a no-brainer:

1) Install it by defining it as dependency in BuildConfig:

grails-app/conf/BuildConfig.groovy:

grails.project.dependency.resolution = {
    plugins {
        compile "org.grails.plugins:clover:3.1.11"
    }
}

For Grails 2.2 or later you must also add a dependency to the Clover Core (clover.jar) or use "legacyResolve true":

grails-app/conf/BuildConfig.groovy:

grails.project.dependency.resolution = {
    plugins {
        compile "org.grails.plugins:clover:3.1.11"
    }
    dependencies {        
        compile "com.cenqua.clover:clover:3.1.11"
    }    
}

2) Or install it by defining it as dependency in POM:

grails-app/conf/BuildConfig.groovy:

grails.project.dependency.resolution = {
    pom true
}

pom.xml:

<dependency>
    <groupId>com.cenqua.clover</groupId>
    <artifactId>clover</artifactId>
    <version>3.1.11</version>
    <scope>compile</scope>
    <type>jar</type>
</dependency>
<dependency>
    <groupId>org.grails.plugins</groupId>
    <artifactId>clover</artifactId>
    <version>3.1.11</version>
    <scope>compile</scope>
    <type>zip</type>
</dependency>

3) Or install it using the 'install-plugin' command (this is deprecated, however):

grails install-plugin clover

4) Once the plugin is installed, instrument code, execute your tests and generate report by

grails test-app -clover.on -clover.view

Further instructions on using Clover for Grails check out the Online Documentation

Description

A plugin that integrates Clover into Grails projects. Clover is a Code Coverage tool that produces beautiful reports which are highly configurable and extensible. Clover not only reports which lines of code were executed during a test run, it also reports which tests hit which lines of code. Clover's reports include:
  • Tag Clouds of your entire project that compare Complexity with Coverage allowing to quickly focus on the most critical code parts
  • A TreeMap to visualise the most complex, uncovered areas of your project
  • Fully Cross Referenced HTML view of your source code
  • Test Optimization speeds-up your daily development by running only these tests which are relevant to source changes made
  • Much more: See http://atlassian.com/clover
  • See the official guide for more info