Exclude methods from code coverage with Cobertura

后端 未结 5 1677
情话喂你
情话喂你 2020-11-27 14:22

Is there a way to exclude code from inclusion into Cobertura coverage reports? We have some methods that should not be included in the coverage report and therefore not driv

5条回答
  •  被撕碎了的回忆
    2020-11-27 14:52

    Cobertura doesn't currently provide such a feature, and neither does Emma (which we use) although it is listed as a forthcoming enhancement - although in the form of an extension to the exclusion rules I believe rather than as an annotation.

    Would be handy to cover off those few inaccessible corners cleanly so that you can strive for 100% without being ridiculous.

    I think annotations would probably be a friendlier way to do it, but they ought to be fairly explicitly named and based on a list of acceptable scenarios as I fear otherwise something like '@ExcludeFromCoverage' would get added over generously.

提交回复
热议问题