Statement Coverage

Statement Coverage measures how many statements in the source code are executed during tests.

There is no instrumentation mode (and no run-time overhead) for obtaining statement coverage with Testwell CTC++.

Testwell CTC++ counts statements the following way:
  • each semicolon is counted as one statement,
  • control statements, which can be written without ";" (like if) are counted as one statement,
  • empty compound statements, i.e. "{}", are counted as one statement,
  • statements outside of functions are not counted.
Example: Each of the following two code segments would be counted as three statements:
if (c) a++; else b++;
if (c) 
{
  a++;
} 
else 
{
  b++;
}
Note: Statement coverage is always included in the reports if the source code was instrumented for decision coverage or for multicondition coverage.