Tuesday, March 13, 2012

Cobertura Goodness for Groovy code in Gradle builds

Was trying to measure code coverage on a Groovy side project and tried a number of Gradle plugins for Cobertura. Settled for this one from Val Kolovos (thanks dude :)), as it just worked out of the box.

By default it doesn't drill into Groovy files to show the line coverage on source files. To get it to do so you need to add the following convention setting in your build.gradle:

cobertura {

coverageSourceDirs = sourceSets.main.java.srcDirs + sourceSets.main.groovy.srcDirs

}

Enjoy.

No comments: