Clover Code Coverage for Grails

  • Tags: testing, coverage, reporting
  • Latest: 4.0.2
  • Last Updated: 13 October 2014
  • Grails version: 1.3.* > *
2 votes
Dependency:
compile ":clover:4.0.2"
Custom repositories:
mavenRepo "https://maven.atlassian.com/repository/public/"
mavenRepo "https://maven.atlassian.com/content/repositories/atlassian-public-snapshot/"
mavenRepo "https://maven.atlassian.com/content/repositories/atlassian-central-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

Plugin version 4.0.0 has an old URL of the Atlassian Public repository (https://maven.atlassian.com/public), which can cause a problem with finding the com.atlassian.com:central-pom artifact. In such case, use the https://maven.atlassian.com/repository/public URL to fetch the artifact.

Installation of Clover for Grails

1) Using the BuildConfig

grails-app/conf/BuildConfig.groovy:

grails.project.dependency.resolution = {
    plugins {
        compile 'org.grails.plugins:clover:4.0.2'
    }
    // For *Grails 2.2* or later you must also add a dependency to the Clover Core
    // or use the "legacyResolve true" option
    dependencies {        
        compile 'com.atlassian.clover:clover:4.0.2' // com.cenqua.clover for Clover 3.x
    }
}

2) Using POM

grails-app/conf/BuildConfig.groovy:

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

pom.xml:

<dependency>
    <groupId>org.grails.plugins</groupId>
    <artifactId>clover</artifactId>
    <version>4.0.2</version>
    <scope>compile</scope>
    <type>zip</type>
</dependency>
<!-- For *Grails 2.2* and later you must also add a dependency to the Clover Core -->
<dependency>
    <groupId>com.atlassian.clover</groupId> <!-- com.cenqua.clover for Clover 3.x -->
    <artifactId>clover</artifactId>
    <version>4.0.2</version>
    <scope>compile</scope>
    <type>jar</type>
</dependency>

Installation of the Clover license key

You can generate a FREE 30-day evaluation Clover license file by logging in to https://my.atlassian.com and following the instructions on the site.

You can place your clover.license file within your Grails project or user home directory (as indicated in the Installation Guide). Alternatively, you can pass the license file's location to the grails command line by adding the Clover option -clover.license.path:

grails test-app -clover.on -clover.license.path=/path/to/clover.license

(!) On Windows platform you must put the "-clover.license.path=c:/path/to/clover.license" in double quotes.

Using Clover

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

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

Customizing Clover

For 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