I need to skip certain methods or code segments from instrumentation and code coverage. That lead me to Exclude methods from code coverage with Cobertura.
Then the cobertura ant page http://cobertura.sourceforge.net/anttaskreference.html said ... You can tell Cobertura to ignore certain classes by passing in "ignore" regular expressions. 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. ....
From the source code of net.sourceforge.cobertura.ant.InstrumentTask.java
for (int i = 0; i < ignoreBranchesRegexs.size(); i++) {
IgnoreBranches ignoreBranchesRegex = (IgnoreBranches)ignoreBranchesRegexs.get(i);
builder.addArg("--ignoreBranches", ignoreBranchesRegex.getRegex());
}
What does the "--ignoreBranches" do? What is the pattern expected? I am going to try it. If you have used above option, please share your "command line"