Menu

#82 Include Classes by Annotation

open
nobody
None
5
2010-07-27
2010-07-27
No

There is no way to include classes for analysis by class / interface annotations.

Use case: part of the application code is public API. Each class / interface in public API is annotated with @PublicAPI. There is a need to collect code coverage statistics solely for public API code.

Discussion

  • Paul Benedict

    Paul Benedict - 2010-07-31

    An alternative solution is to introduce a @Category annotation ala JUnit 4.8. This annotation is an adhoc categorization. If Cobertura were to have something similar, you could then target one or several category combinations for your coverage report.

     
  • Paul Benedict

    Paul Benedict - 2010-07-31

    Also, JavaDoc allows grouping via package wildcards. I wonder if a wildcard filter could be enabled since your public API should follow predictable naming pattern(s).

     
  • Vladimir Tsukur

    Vladimir Tsukur - 2010-07-31

    Wildcard filter may not be applied because there is an established convention in the project that says that classes and interfaces as public API only if they are annotated with specific annotation. The same package may contain both public API classes and non-public API.

     
  • Nobody/Anonymous

    Do you only want code coverage on classes that have access modifier "public"?

     
  • Vladimir Tsukur

    Vladimir Tsukur - 2010-08-02

    Initial use case requires collecting code coverage only for public classes but I think it would be good to set it up for all classes regardless of access modifier.