Menu

#85 A way to ignore certain methods/lines in report

open
nobody
None
5
2010-10-29
2010-10-29
lindsal
No

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

Discussion

  • songjie dong

    songjie dong - 2010-11-16

    maybe we could have another mode for instrument because tree pattern would be better for complex ignore rule, what about you guys?

     
  • Guile

    Guile - 2012-12-18

    +1

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.