Q: Why does Clover use source code instrumentation?Source code instrumentation is the most powerful, flexible and accurate way to provide code coverage analysis.The following table compares different methods of obtaining code coverage and their relative benefits:
Possible feature | JVMDI/PI | Bytecode instrumentation | Source code instrumentation |
---|---|---|---|
Gathers method coverage | yes | yes | yes |
Gathers statement coverage | line only | indirectly | yes |
Gathers branch coverage | indirectly | indirectly | yes |
Can work without source | yes | yes | no |
Requires separate build | no | no | yes |
Requires specialised runtime | yes | yes | no |
Gathers source metrics | no | no | yes |
View coverage data inline with source | not accurate | not accurate | yes |
Source level directives to control coverage gathering | no | no | yes |
Control which entities are reported on | limited | limited | yes |
Compilation time | no impact | variable | variable |
Runtime performace | high impact | variable | variable |
Container friendly | no | no | yes |