4.3.2 Branch Testing and Branch Coverage Flashcards
A branch is a transfer of “ “ between t… in the con… , which shows the possible “ “ in which sou… are executed in the t…
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 t… 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 t… divided by the total number of “ “ and is expressed as a “ “.
test cases
branches
percentage
When 100% branch coverage is achieved, all b… “un… “ and “ “, are exercised by t…
branches in the code,
unconditional
conditional,
test cases.
Conditional branches typically correspond to:
- a true or f… from an i…
- an outcome from a s…
- a decision to exit or c…
- false outcome
if…then decision - switch/case statement
- continue in 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 s…
statement coverage.
Any set of test cases achieving 100% branch coverage also a…
achieves 100% statement coverage (but not vice versa).