Showing posts from October, 2012

Excluding database migration changelog files from cobertura coverage in Grails

This took me a while to figure out so I thought it was worth a quick post. As is clear from the Grails Cobertura plugin documentation it is possible to exclude certain classes or packages from the coverage reports. This is very useful where there are classes such as configuration files that are impossible or pointless to test, and impact negatively on the results of your code coverage. Take this example which excludes all your typical Grails config and resources files. coverage { exclusions = ["*Config*", "*Resources*"] } In the case of Cobertura changelog files, the natural action is to add an exclude based on the assumption that the changelog is a Class, like so: coverage { exclusions = ["*Config*", "*Resources*", "*changelog*"] } But that assumption turned out to be wrong. The changelog is actually the package name so you need to add the following to get the desired exclusions: coverage { exclusions = ["*Conf…