TL;DR
In the previous post, we explained what the test requirement is? Today we discuss the coverage criterion. We will introduce you to software testing based on the remarkable book, Introduction To Software Testing by Paul Ammann and Jeff Offutt.
Coverage Criterion
A coverage criterion is a rule or collection of rules that impose test requirements on a test set [Ammann, Offutt].
The coverage criterion describes test requirements completely and unambiguously. In our sanitizer example, we have a sanitizer type criterion. This criterion generates following Test Requirements:
T R = { type = “surface”, type = “electronics”, type = “hands” }
We create a Test Set T to cover test requirements.
Coverage
Coverage requirement is that test set T satisfies coverage criterion C. C is satisfied with test set T only if for each test requirement from T R we have at least one test in T that satisfies test requirement from T R[Ammann, Offutt].
Test Set T = { “surface sanitizer”, “hand sanitizer”, “electronic sanitizer” } satisfies sanitizer type Criterion C.
100% Coverage is sometimes expensive to achieve.
Coverage Level
Coverage Level is a ratio number of satisfied T R with T divided by the size of T R [Ammann, Offutt].
We already stated that some coverage criteria are expensive to satisfy. But sometimes, it is not possible to satisfy the coverage criteria. For example, at the beginning of the COVID pandemic, it was impossible to get any type of sanitizer in Croatia.
We called such T R infeasible test requirements. An example in software development is dead code—part of the program that could not be reached.
Criteria Subsumption
A coverage criterion C1 subsumes C2 if and only if every test set that satisfies criterion C1 also satisfies C2. [Ammann, Offutt].
In our sanitizer example coverage criteria, C1 sanitizer type subsumes C2 color = “transparent” because each type is transparent.
Remember
In which cases, a 100 % coverage of test requirements is not possible.