I was trying to ignor开发者_Python百科e all the toString() methods from instrumentation using following configuration. This wasn't really working? This is using cobertura as maven plugin. This was based on a previous answer Exclude methods from code coverage with Cobertura.
<instrumentation>
<ignores>
<ignore>toString</ignore>
</ignores>
</instrumentation>
What do you think I'm doing wrong. I wasn't able to find an example for this on the cobertura documentation.
cobertura-ant reference
"The ignore pattern can be any valid perl 5 regular expression. This will ignore any calls to any method that matches the ignore regular expression. It will NOT skip over these classes during instrumention. To exclude classes from being instrumented, either exclude them from your fileset or use the alternative method below and specify an excludeClasses pattern."
<cobertura-instrument todir="${instrumented.dir}">
<ignore regex="org.apache.log4j.*" />
...
</cobertura-instrument>
I believe you have to change "ignores" to "ignore" and use a regular expression to define the whole class name before the method (or just an * in you case to exclude toString
from any class).
精彩评论