Introduction
When testing software, it is important to check that every possible decision point in the code works correctly. Branch coverage helps find out if all the different paths in the code have been tested, so no part is left unchecked.
Imagine a road with a fork where you can go left or right. To explore the whole area, you need to travel both paths. Branch coverage is like making sure you have walked down every fork in the road to see what’s there.
┌─────────────┐
│ Start │
└─────┬───────┘
│
▼
┌─────────────┐
│ Decision? │
├─────┬───────┤
│ │ │
▼ ▼ ▼
Path1 Path2 End
def check_number(num): if num > 0: return "Positive" else: return "Zero or Negative" print(check_number(5)) print(check_number(-3))