ISTQB-ATTA practice question 3 of 15
Which additional set of test cases is needed to achieve both 100% statement coverage and 100% decision coverage? 3 credits [K3]
Full set: 65 questionsThe analysis assumes the first condition in the code is IF x >= 0 THEN instead of IF x > 0 THEN. With the original code (x > 0), none of the provided options would add the necessary coverage. Given the corrected code and the existing test cases TC1(x=1, y=1) and TC2(x=-1, y=-1):
1. TC1 (x=1, y=1): Covers x >= 0 as TRUE and y > 0 as TRUE. This single test case achieves 100% statement coverage.
2. TC2 (x=-1, y=-1): Covers x >= 0 as FALSE.
3. Missing Coverage: The decision outcome for y > 0 as FALSE has not been tested. To test this, a case is needed where x >= 0 is TRUE and y > 0 is FALSE (i.e., y <= 0). Test case A (x=0, y=0) satisfies these conditions, covering the missing decision outcome and achieving 100% decision coverage.
Regarding the question as written (IF x > 0): All options are incorrect, as none provide a test case where x > 0 and y 0 (False) branch. B: This test case (x=1, y=1) is identical to the existing TC1 and provides no new statement or decision coverage. C: With the corrected code (x >= 0), this case (x=0, y=1) makes x >= 0 TRUE and y > 0 TRUE, which is already covered by TC1. D: This is identical to option C and is therefore also incorrect for the same reason.
1. ISTQB® Certified Tester Advanced Level - Technical Test Analyst Syllabus Version 1.1 (2021)
Section 2.3.1
"Statement and Decision Testing". This section defines decision coverage as requiring each decision outcome (both TRUE and FALSE branches) to be exercised. The analysis directly applies this principle to identify the missing decision outcome.
2. Ammann
P.
& Offutt
J. (2016). Introduction to Software Testing (2nd ed.). Cambridge University Press. Chapter 2
"Coverage Criteria
" provides the formal definitions for graph-based coverage
including Edge Coverage
which is equivalent to decision/branch coverage. The logic for finding a test case to cover a specific edge (decision outcome) follows the principles outlined here.
Keep practicing
Take the free ISTQB-ATTA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other ISTQB-ATTA practice questions
- Question 4How many test cases are needed to test code fragment lines 26 – 32 to achieve 100% condit…
- Question 6It has been suggested to organize a performance test to find out more regarding the third…
- Question 7To address reliability a number of measures will be taken throughout the development and …
- Question 8A developer has spent three days looking at a system that crashes now and then. The probl…
- Question 9Based on the state diagram above, how many test cases are needed to achieve 1-switch cove…
- Question 10What is the value of statement coverage achieved by test case 1 from test set A? 2 credit…
