Working
There are many approaches to code coverage measurement.
Broadly there are three approaches, which may be used in combination:
http://www.onestoptesting.com/code-coverage/working.asp#">
Instrumentation |
This approach adds instrumentation statements to
the source code and compiles the code with the normal compile tool
chain to produce an instrumented assembly. |
|
Intermediate code Instrumentation |
Here the compiled class files are instrumented by
adding new bytecodes and a new instrumented class generated. |
Runtime Information collection |
This approach collects information from the
runtime environment as the code executes to determine coverage
information |
Clover uses source code instrumentation,
because although it requires developers to perform an instrumented build,
source code instrumentation produces the most accurate coverage measurement
for the least runtime performance overhead.
As the code under test executes, code
coverage
systems collect information about
which statements have been executed. This information is then used as the
basis of reports. In addition to these basic mechanisms, coverage approaches
vary on what forms of coverage information they collect. There are many
forms of coverage beyond basic statement coverage including conditional
coverage, method entry and path coverage.
|