Software Testing & QA (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
Understanding Code Coverage Metrics: Line vs. Branch vs. Function vs. Path Coverage.
junior LevelMost Askedsoftware-testingBasic
In Simple Words:
- Line/Statement Coverage: The percentage of executable lines of code executed by tests.
- Function Coverage: The percentage of declared functions invoked at least once.
- Branch Coverage: Measures whether every decision branch (e.g., both the
if (true)andelse (false)paths) was evaluated. - Path Coverage: The most rigorous metric: measures whether every possible execution sequence through all loops and branches was traversed.
- The 100% Coverage Myth: 100% statement coverage does not mean software is bug-free. It proves only that lines were executed, not that edge cases (null pointers, race conditions, network dropouts) were asserted!