wiki:Developer/Coverage/Theory

Version 5 (modified by GlennHumphrey, on Sep 10, 2009 at 12:26:54 AM) (diff)

Added intro material

Coverage Analysis Theory

Table of Contents

    Error: Page Developer/Coverage/CoverageAnalysisTheory does not exist

The subject of Code Coverage Analysis is broad and has been written about many times over. This background material is not intented to summerize or rehash what can be read elsewhere. Instead, the focus here will be on the aspects of Code Coverage Analysis as they pertain to the RTEMS Coverage Analysis effort.

The ultimate goal of Code Coverage Analysis is to ensure that every line of generated assembly in a particular configuration is executed by the test suite, that the tests exercise both taking and not taking every branch, and that every line of source code is actually tested. In order to achieve this goal, several different coverage criteria may have to be examined. Let's consider the following criteria:

  • Object coverage - Has each line of generated assembly been executed?
  • Statement coverage - Has each line of the source code been executed?
  • Decision coverage (also known as Branch coverage) - Has each control structure (such as an if statement) evaluated both to true and false?
  • Condition coverage - Has each boolean sub-expression evaluated both to true and false (this does not necessarily imply decision coverage)?
  • Modified Condition/Decision? Coverage|Modified Condition/Decision? Coverage (MC/DC) - Has every condition in a decision taken on all possible outcomes at least once? Has each condition been shown to affect that decision outcome independently?

Imported from old wiki.]]

This is beyond statement level coverage in that we have to verify both paths of a C line like the following is executed:

x = (y) ? z : a;

That is one statement but includes a branch. That makes it one point to cover when viewed using statement coverage. But it is two points to cover in our object level coverage of generated assembly.

Object Coverage

TBD

Statement Coverage

Statement coverage verifies that each line of source code in a source file is represented by generated assembly and that that assembly code is exercised.

Decision Coverage

TBD

MC/DC

This is also known as Modified Condition/Decision Coverage.

Attachments (1)

Download all attachments as: .zip