This can be caused by a number of problems:
1. Classes that do not start according to the jacoco agent
The first thing you need to check is whether your classes B and C are called by the jacoco agent. This can be done by creating a jacoco report and clicking on the session link (upper right corner).
If your class B or C is not listed here, it means that your jacoco agent has a problem, and it was not tied to the correct JVM that runs the B / C class, or if no code in the B / C class was called.
2. Classes launched according to the jacoco agent, but not available source files / classes
If your B or C class is listed here, but it is not clickable, it means that your B / C class was launched and detected by the jacoco agent, but it could not bind it.
Keep in mind that when creating a report, jacoco must have class files and source files to create the report. (if you use maven, it expects class files in the project.build.outputDirectory file and sources in the project.build.sourceDirectory file
3. Classes run according to the jacoco agent, but class files available
If your class B or C is deployed to the application server, it is possible that the application server also uses the bytecode of these classes during deployment, creating a situation where the class files in your local project do not match the class files detected by the jacoco agent (see this topic to discuss this issue: https://groups.google.com/forum/?fromgroups=#!topic/jacoco/GjSlBoFTRrc ). In this case, Jacoco offers the classdumpdir parameter, which can be set to the folder in which jacoco will unload the classes detected during the test run. You must use these classes when generating the report.
References
source share