I have been using cobertura for around a month, so am a relative
newbie. A feature I would find very useful is a way to distinguish between (a) untested
code that I know about and have decided not to test and (b) untested
code that I plan to write tests for.
Is there way to do this other than at the class level?
If not, I thought a simple way to implement this might be to have a
plain text file listing things to ignore.
The syntax could something like the following:
package.ClassName //ignore whole class
package.ClassName.main //ignore main method
**.set* //ignore all setter methods in all classes
file:package/ClassName.java:20,50,56 //ignore lines 20, 50, 56 in file
file:package/ClassName.java:"a = b || c;" //ignore line(s) matching the expression in quotes in file
file:**/*.java:assert** //ignore assertions in all files
Then in the coverage report, there could be two extra categories:
covered ignored and uncovered ignored (which perhaps could be shaded
grey).
Best,
Luke
maybe we could have another mode for instrument because tree pattern would be better for complex ignore rule, what about you guys?
I agree with the need; this would be particularly useful for private constructors. There's a workaround described at http://blog.paulhildebrand.nl/java/163/improve-code-coverage-on-private-cronstructors-with-cobertura but it's a little untidy. An extension to the existing ignore tag in the ANT task might work.
+1