Skip to content
Search

Code coverage

lastmod 2020-12-14created 2016-01-152 edits

Code coverage is one of the metrics used, when discussing software testing, to indicate how sufficient the testing is. As the name says, it is how much of the code is covered: how much of the code itself was executed when the software was tested.

Code structure consists mainly of statements (Statement), conditions (Condition), and decisions (Decision). Code coverage criteria are divided according to how much of each of these structures is covered. The most commonly used is statement (Statement) coverage, which is satisfied when each executable code line runs at least once. Condition (Condition) coverage is satisfied when each internal condition takes both true and false. Decision (Decision) coverage is satisfied when the overall outcome of each branch, driven by those conditions rather than the internal conditions themselves, is both true and false. There is also MC/DC coverage, which considers conditions and decisions together. Coverage can be measured by hand by adding log output or by using a debugger, but this is a very laborious process. Many code coverage tools are available, with LDRA and VectorCAST as representative examples.

See also

Favorite site

author Zer0 sitemap