Which type of code coverage measures whether each decision point (like an if statement) has been evaluated both true and false during testing?
Think about coverage that checks all possible outcomes of decisions.
Branch coverage ensures that every possible branch (true and false) of decision points is tested. Statement coverage only checks if each line runs, function coverage checks if functions are called, and path coverage is more detailed, covering all possible paths.
If a program has 100 executable statements and a test suite executes 85 of them, what is the statement coverage percentage?
Coverage percentage = (executed statements / total statements) * 100
Statement coverage is calculated by dividing the number of executed statements by the total statements, then multiplying by 100. Here, 85/100 * 100 = 85%.
A test suite shows 90% statement coverage but only 50% branch coverage. What does this most likely indicate about the tests?
Think about what branch coverage measures compared to statement coverage.
High statement coverage with low branch coverage means most lines run but some branches (true/false outcomes) of decisions are not tested. This can hide bugs in untested decision paths.
Which statement best describes the difference between path coverage and branch coverage?
Consider how many combinations of branches each coverage type requires.
Path coverage requires testing every possible path through the code, which includes all combinations of branches. Branch coverage only requires each branch to be tested at least once, not all combinations.
If a software project achieves 100% statement coverage but still has bugs, what is the most likely reason?
Think about what statement coverage measures and what it does not.
Statement coverage only ensures every line runs during tests but does not guarantee all logical paths or input cases are tested. Bugs can remain in untested decision outcomes or input scenarios.