Condition coverage test

from Wikipedia, the free encyclopedia

The condition coverage test belongs to a group of coverage tests that are used to test software .

The problem with the previous coverage tests (C1 test, C2 test) is that compound, hierarchical conditions are not tested sufficiently.

C3a - single condition coverage test

Every simple condition must be tested once with true and once with false . Example:

     boolean a,b;
     if(a || b) {...}
    Testfall 1 wäre a=false und b=false. Testfall 2 wäre a=true und b=true.

C3b - multiple condition coverage test

This test looks at all atomic conditions of a condition. If there are n atomic conditions in the condition, then combinations are formed. For the above example this means that 4 test cases are created.

C3c - minimum multiple condition coverage test

This version creates more test cases than C3a and fewer than C3b by evaluating each condition (atomic and composite) to true and false. The logical structure is taken into account and the C1 test ( branch coverage test ) is completely included in this test. Another point is that the C3c test is predictable.

disadvantage

  • Incomplete evaluation of a condition by a programming language with so-called short circuit evaluation such as B. C / C ++, Java, C #.

Example:

     if (a && b)  {...} else { lese b aus }
     Wenn a false ist, dann ist die Belegung der Variable b egal.
     z. B. a=false und b=null, dann passiert ein Fehler im else-Zweig


Individual evidence

  1. Karol Frühauf, Jochen Ludewig, Helmut Sandmayr: Software testing. A guide to testing and inspection . 6th, revised and updated edition. vdf, Hochschulverlag AG at the ETH, Zurich 2007, ISBN 978-3-7281-3059-4 , p. 63 .