ISTQB-CTFL · Question #108
During component testing of a program if 100% decision coverage is achieved, which of the following coverage criteria is also guaranteed to be 100%?
The correct answer is D. 100% Statement coverage. Statement coverage is a structural coverage metric that measures the percentage of executable statements in the source code that are executed by a test suite. Decision coverage is another structural coverage metric that measures the percentage of decision outcomes (such as…
Question
During component testing of a program if 100% decision coverage is achieved, which of the following coverage criteria is also guaranteed to be 100%?
Options
- A100% Stale transition coverage
- B100% Equivalence class coverage
- C100% Boundary value coverage
- D100% Statement coverage
How the community answered
(57 responses)- A7% (4)
- B19% (11)
- C30% (17)
- D44% (25)
Explanation
Statement coverage is a structural coverage metric that measures the percentage of executable statements in the source code that are executed by a test suite. Decision coverage is another structural coverage metric that measures the percentage of decision outcomes (such as branches or conditions) in the source code that are executed by a test suite. Decision coverage is a stronger metric than statement coverage, because it requires that every possible outcome of each decision is tested, while statement coverage only requires that every statement is executed at least once. Therefore, if a test suite achieves 100% decision coverage, it also implies that it achieves 100% statement coverage, because every statement in every branch or condition must have been executed. However, the converse is not true: 100% statement coverage does not guarantee 100% decision coverage, because some branches or conditions may have multiple outcomes that are not tested by the test suite. For example, consider the following pseudocode: if (x > 0) then print("Positive") else print("Non-positive") end if A test suite that executes this code with x = 1 and x = -1 will achieve 100% statement coverage, because both print statements are executed. However, it will not achieve 100% decision coverage, because the condition x > 0 has only been tested with two outcomes: true and false. The third possible outcome, x = 0, has not been tested by the test suite. Therefore, the test suite may miss a potential bug or error in the condition or the branch.
Topics
Community Discussion
No community discussion yet for this question.