Install the plugin
In case you use Grails older than 2.3.5 then you can install the Clover-for-Grails plugin by running the following Grails command in the root of your Grails project directory.
The 'grails install-plugin' command has been removed in Grails 2.3.5 upwards. So in case you use Grails 2.3.5 or higher, we recommend adding the Clover plugin to your project's BuildConfig.groovy or pom.xml. For more installation options, please see Clover-for-Grails Installation Guide.
Generate a coverage report
To generate a basic Clover code coverage report, you need to add the Clover option
-clover.on to the
grails test-app command line target for running unit
tests against your Grails project.
Adding the Clover option
to this Grails command makes the report open in a browser window immediately after generation.
If you omit this command line option, Clover will generate a report that you can then open
If you find that Clover-for-Grails runs out of memory, try increasing the Grails PermGen allocation by either setting the JAVA_OPTS environment variable:
Alternatively, you can define this variable in the
startGrails (Linux/UNIX/Mac OS X) or
startGrails.bat (Windows) script in the
<Grails Home Directory>/bin