New version of Code Coverage plugin released
January 30, 2008 – 6:21 amI released an updated version of the code coverage plugin for Grails today. This release incorporates some of the suggestions others have offered in the last few days:
- renamed the “test-app-coverage” script to “test-app-cobertura” - perhaps in the future we will add another code coverage library (EMMA?) to the plugin so users can choose which they would like to run
- Added a “-xml” option for the command line. By default, the plugin will generate HTML reports. If you would like and XML report (e.g. for a continuous integration server), run the command like this: grails test test-app-cobertura -xml
- Added a dependency check for the grails version in the plugin file. The script was written against Grails 1.0-final-SNAPSHOT and it’s not backwards compatible with previous versions of Grails (sorry).
- Added some metadata to the plugin file (title, description, etc) so the information appears correctly when you do a grails list-plugins
Another bug was raised - when you run the script, Grails sets the environment to “development” by default. This may be OK if your DEV and TEST datasource definitions are the same - but if they’re not, please run the script with the grails environment set to test. As far as I know you can do this one of two ways:
- grails test test-app-cobertura
- grails -Dgrails.env=test test-app-cobertura
The plugin source is now available in the Grails plugins SVN repository. You can install it by running grails install-plugin code-coverage or by downloading the zip file from here: http://plugins.grails.org/grails-code-coverage/trunk/grails-code-coverage-0.3.zip
