0
0
Testing Fundamentalstesting~5 mins

Branch coverage in Testing Fundamentals - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AWhether the code is free of syntax errors
BWhether each line of code is executed
CWhether the software meets user requirements
DWhether each decision branch (true/false) is executed
If an if statement has no else, how many branches does it have?
ATwo
BOne
CThree
DZero
Which coverage is more detailed: statement coverage or branch coverage?
ABoth are the same
BStatement coverage
CBranch coverage
DNeither
What does 100% branch coverage guarantee?
AAll decision outcomes are tested
BAll code lines are executed
CNo bugs remain
DAll user requirements are met
Why might branch coverage miss some bugs?
ABecause it only tests syntax
BBecause it doesn't check data values inside branches
CBecause it tests all user inputs
DBecause it ignores decision points
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.