Posts Tagged functional behaviour

Misapprehension 5: Coverage does not depend on how the software is written

No. Even two software snippets which are functionally equivalent (i.e. the two snippets always deliver the same result for the same input) and which are written in the same programming language can require a different number of test cases to reach the same percentage of coverage for a certain measure.

Two software snippets which are functionally equivalent

The two software snippets S1 and S2 in the figure above are functionally equivalent. In spite of this for reaching e.g. 100% branch coverage you need only two test cases for S1, but seven test cases for S2.
As a consequence you can avoid by appropriate implementation that a certain measure has to be determined at all, because if for instance the complete software is written like S2 (i.e. without using logical AND and OR), from 100% branch coverage follows 100% condition coverage, what reliefs you from measuring condition coverage at all.


No Comments