Purpose
Teams monitor this metric to ensure that all code components are tested and work as designed when they are integrated.
Definition
Count:
-
number of test cases per identified code component
-
number of code components with code changes but no associated test cases
Analysis
Ensure that code components are covered by test cases, so defects are not lurking in untested components. Typical code
coverage is 60-80%. New functionality or new components should have 50 - 90% test coverage.
Collection and reporting tools
IBM® Rational® PurifyPlus® collects code coverage data. IBM® Rational® Quality manager® collects test case data.
Assumptions and prerequisites
-
Traceability must be established between code components and test artifacts.
Pitfalls, advice, and countermeasures
-
The team should balance code coverage with risk. Only aim for 100% coverage when required by regulation as
this is not viable economically otherwise.
-
Not all code requires testing, or the same amount of testing. The team should consider and plan code
coverage, and be able to justify decisions in test allocation.
-
Use a combination of tools and automated test scripts to increase test coverage.
-
Each time there is a change in a component (at least) regression testing should be performed
-
The coverage percentage is not the only indicator of the effective testing process. The team should also consider
the quality of the tests.
|