Search code examples
javamavencobertura

Cobertura unable to instrument java Interfaces


I am using Cobertura for code coverage of my Java code using maven. When the reports are generated, I found out that there is no coverage generated for Interfaces.java. While going through the logs, I found below:

[cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport - Data file does not contain instrumentation information for the file com/example/Interface.java. Ensure this class was instrumented, and this data file contains the instrumentation information.

[file name mocked up]

Please let me know the reason for this. How can I have code coverage for interfaces in java.

Thanks


Solution

  • As commented by Tassos Bassoukos, Interfaces don't have any code, thus there is no possibility of instrumentation. Instead, instrument all classes that implement that interface. So, cobertura will not be able to show code coverage for interfaces, and skip the interfaces.java files.