25.8. Coverage

25.8.1. Overview

The Coverage sensor data type is designed to represent the results of test coverage over a single functional unit (such as a method) in a system in a language-independent manner. Table 25.9, “Coverage SDT attributes” documents its attributes.

Table 25.9. Coverage SDT attributes

AttributeDescription
tstampThe UTC time at which this data was collected.
toolA string indicating the tool that collected this data, such as "JBlanket".
runTimeAn identification tag that can be used in analysis to combine measurements that were taken after one complete execution of the coverage tool. Typically, this value is the UTC time (converted to milliseconds) the coverage measurement was taken. This time may differ from tstamp.
granularityThe type of coverage being measured, i.e., method, statement, branch, etc.
fileNameThe fully qualified file path.
coveredThe number of instances at the specified granularity level in className that were exercised during testing.
uncoveredThe number of instances at the specified granularity level in className that were not exercised during testing.

Note that emma sensor also sends the optional java class name in pMap field under the key className.

25.8.3. Applications of the Coverage SDT

The JBlanket tool generates method-level coverage data for Java files using byte code instrumentation. A sensor for JBlanket represents this data as Coverage entries.

Once collected, Coverage data can be used to track trends in the quality of testing of a system as it is developed. For example, if the level of coverage in a system is declining over time, then it may indicate that the proportion of resources devoted to testing should be increased.