4.3.2 Branch Testing and Branch Coverage Flashcards
A branch is a transfer of “ “ between … in the con… which shows the possible “ “ in which sou… are executed in the …
control
two nodes
control flow graph
sequences
source code statements
test object.
Each transfer of control can be either:
- unc…
- con…
- unconditional (ie straight-line code)
- conditional (ie a decision outcome)
In branch testing, the coverage items are “ “ the aim is to design … to exercise b… until an acceptable level of c…
branches
test cases
branches in the code
coverage is achieved
Branch coverage is measured as the number of branches exercised by the … / by the total number of “ “ and is expressed as a “ “.
test cases
branches
%
When 100% branch coverage is achieved all b… “un… “ and “ “, are exercised by …
branches in the code,
unconditional
conditional,
test cases.
Conditional branches typically correspond to:
- a true or … from an i…
- an outcome from a s…
- a decision to exit or c…
- false outcome
if…then decision - switch/case statement
- or continue a loop
However, exercising a branch with a test case will not d…
Ex. May not detect defects requiring the execution of a s…
detect defects in all cases.
specific path in a code.
Branch coverage subsumes…
statement coverage.
Any set of test cases achieving 100% branch coverage also …
achieves 100% statement coverage (but not vice versa).