Recall & Review
beginner
What is branch coverage in software testing?
Branch coverage measures whether each possible branch (true/false decision) in the code has been executed at least once during testing.
Click to reveal answer
beginner
Why is branch coverage important?
It helps find bugs in decision points by ensuring all branches of conditional statements are tested, improving test thoroughness.
Click to reveal answer
intermediate
How does branch coverage differ from statement coverage?
Statement coverage checks if each line runs, but branch coverage checks if each decision path (true/false) runs, making it more detailed.
Click to reveal answer
beginner
Example: If a code has an if-else statement, how many branches are there?
There are two branches: one for the 'if' condition being true, and one for it being false (the 'else').
Click to reveal answer
intermediate
What does 100% branch coverage mean?
It means every possible branch in the code has been executed at least once during testing, covering all decision outcomes.
Click to reveal answer
What does branch coverage measure in testing?
✗ Incorrect
Branch coverage focuses on testing all possible paths of decisions, like true and false branches.
If an if statement has no else, how many branches does it have?
✗ Incorrect
Even without an else, the if condition can be true or false, so there are two branches.
Which coverage is more detailed: statement coverage or branch coverage?
✗ Incorrect
Branch coverage checks all decision paths, which is more detailed than just checking lines executed.
What does 100% branch coverage guarantee?
✗ Incorrect
100% branch coverage means every true and false path in decisions has been tested.
Why might branch coverage miss some bugs?
✗ Incorrect
Branch coverage ensures paths run but may miss bugs related to specific data values inside those paths.
Explain branch coverage and why it is useful in testing.
Think about how decisions in code create different paths to test.
You got /3 concepts.
Describe how you would achieve 100% branch coverage for a simple if-else statement.
Consider testing both outcomes of the condition.
You got /3 concepts.