
This tutorial shows you the main steps in measuring code coverage with the Coverage API. The sample program in the tutorial creates a standalone measurement (not a measurement in a series), runs a test program, and then reports the code coverage results.
The scenario illustrates a good way to instrument a test program for a quick ad hoc measurement of code coverage.
For more systematic measurement of code coverage, see the tutorial on measurement series.
The tutorial measures code coverage synchronously in a single program context.- coverage instrumentation and test program inline in a single program. But of course the Coverage API also lets you record asynchronous user activity. See for example: Saving and Reloading a Measurement.
The tutorial topics are the following:
Step 1: Creating a Measurement
Step 2: Measuring Code Coverage
Step 3: Calculating Code Coverage Results
Step 4: Traversing the Hierarchy of Results
Step 5: Displaying the Code Coverage Results
Step 6: Saving Code Coverage Results
Step 7: Finalizing a Measurement
Additional topics relating to measurements include these:
Measuring Code Coverage in Overview
Merging Code Coverage Measurements
Saving and Reloading a Measurement
Assigning Measurements to a Measurement Series