Code coverage overview
Source code coverage consists of identifying which portions of a program are executed or not during a given test case. Source code coverage is recognized as one of the most effective ways of assessing the efficiency of the test cases applied to a software application.
- Statement blocks, decisions, and loops.
- Function or procedure calls.
- Basic conditions, modified conditions/decisions (MC/DC), multiple condition, and forced condition.
- Procedure entries and exits.
- Terminal or potentially terminal statements
- Statements that are considered non-coverable in C.
Information modes
The information mode is the method used to code the trace output. This has a direct impact of the size of the trace file as well as on CPU overhead. You can change the information mode in the coverage type settings. See Changing code coverage settings.
- Default mode: Each branch generates one byte of memory. This offers the best compromise between code size and speed overhead.
- Compact mode: This is functionally equivalent to Pass mode, except that each branch needs only one bit of storage instead of one byte. This implies a smaller requirement for data storage in memory, but produces a noticeable increase in code size (shift/bits masks) and execution time.
- Hit Count mode: In this mode, instead of storing a Boolean value indicating coverage of the branch, a specific count is maintained of the number of times each branch is executed. This information is displayed in the code coverage report.
Count totals are given for each branch, for all trace files transferred to the report generator as parameters. In the code coverage report, branches that have never been executed are highlighted with an asterisk '*'. The maximum count in the report generator depends on the amount of memory available on the computer running the tests. If this maximum count is reached, the report signals it with a Maximum reached message.
}
) in
a function after a return statement is always displayed in red in
the coverage report, even if the function reports 100% coverage.