We're using the IntelliJ IDEA code coverage runner. We've got some code within classes where we don't want the code coverage to run. Things like extreme conditions or places where writing a test to cover that very specific case just isn't possible.
Is there an annotation or "special comment" (eg., "// START CODE COVERAGE IGNORE", "// END CODE COVERAGE IGNORE") that we can apply?
Note that the case isn't where we want to exclude an entire package or class, just parts within classes.
not, it's impossible now.
IDEA's coverage works over bytecode so comments could be processed only in the editor and this would highly impact the productivity (persentage should be recalculated according to text). With annotations it could be done more efficiently but again - it would have its cost.
Do you need 100% coverage?
No, we don't need 100% percent coverage, but we do have a number of these cases which cause our coverage numbers to be lower than we'd like.
There is no UI for that.
You may run your configuration with -javaagent property copied from "Run with coverage" and pass there additional -exclude parameter (rexeps on classnames)