maven build/verify scanning class but not showing in coverage report

15 Views Asked by At

Trying to generate jacoco code coverage report , test class is getting scanned but getting below warning :

[WARNING] Classes in bundle '<module_name>' do not match with execution data. For report generation the same class files must be used as at runtime.

[WARNING] Execution data for class com/netcore/generic/handler/service/<class_name> does not match.

These classes are not showing in report as well, have used below with test class


@PrepareForTest(
        {<class_name>.class
                })
@RunWith(PowerMockRunner.class)
@PowerMockIgnore("jdk.internal.reflect.*")

Got below solution in document but not sure how to implement any of these:

From jacoco (0.7.8) doc " If classes get modified at runtime in your setup there are some workarounds to make JaCoCo work anyways: If you use another Java agent make sure the JaCoCo agent is specified at first in the command line. This way the JaCoCo agent should see the original class files.
Specify the classdumpdir option of the JaCoCo agent and use the dumped classes at report generation. Note that only loaded classes will be dumped, i.e. classes not executed at all will not show-up in your report as not covered. Use offline instrumentation before you run your tests. This way classes get instrumented by JaCoCo before any runtime modification can take place. Note that in this case the report has to be generated with the original classes, not with instrumented ones."

0

There are 0 best solutions below