On this page:
Install the Clover-for-Grails plugin by running the following Grails command in the root of your Grails project directory.
grails install-plugin clover
For more installation options or to upgrade this plugin, please see Clover-for-Grails Installation Guide.
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.
grails test-app -clover.on -clover.view
Adding the Clover option -clover.view
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 manually.
clover.license
file to the grails
command lineIf you have not placed your clover.license
file within your Grails project or user home directory (as indicated in the Installation Guide), you can pass the license file's location to the grails
command line by adding the Clover option -clover.license.path=/path/to/clover.license
:
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, otherwise it won't work (it's a Grails feature).
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:
export JAVA_OPTS="-XX:MaxPermSize=192m"
set JAVA_OPTS="-XX:MaxPermSize=192m"
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
directory.