There are a large number of bean classes in a project that I'm working on, (in the 100s), and I'd like to be able to exclude the simple property methods from code coverage metrics. I had been excluding all bean classes at first, then switched to excluding property methods.
The problem with both of these is that some of the beans have at least a small amount of logic in the getter and setter methods; these I feel should be considered for code coverage metrics.
Ideally, I would be able to exclude any methods that are < 3 lines and have a complexity of 1, but I've been unable to find a way to do this in Clover for Maven.
Hi Nick,
You can exclude certain methods based on their number of statements or complexity, but only using Clover-for-Ant - see the <clover-setup> / <methodContext> element, the 'statements' / 'aggregatedStatements' / 'complexity' / 'aggregatedComplexity' attributes.
In case of Clover-for-Maven, the configuration option is simplified and you can define only method's name using a regular expression. There is an improvement request raised to add statements and complexity attributes:
https://jira.atlassian.com/browse/CLOV-1173
and it's scheduled for Clover 4.1.1 at the moment (end of 2015 probably); but feel free to contribute if you need this urgently - sources are on https://bitbucket.org/atlassian/maven-clover2-plugin/.
Cheers
Marek
Thanks Marek - it's not really urgent, just trying to convince my team of the value of these metrics, and figure the more accurate they are the easier that will be. I may take a look at the source - thanks for the link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I case you'd decide to check sources - it's in com.atlassian.maven.plugin.clover.internal.AbstractCloverInstrumentMojo. Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.