How many test cases are necessary in order to achieve 100% statement coverage?

The following program part is given:

IF (condition A)

then DO B

END IF

How many test cases are necessary in order to achieve 100% statement coverage?
A . 1
B . 2
C . 4
D . a very high number

Answer: B

Explanation:

To achieve 100% statement coverage, you need to execute every statement in the code at least once. In this case, you need two test cases: one where condition A is true and one where condition A is false. This way, you can cover both the DO B statement and the END IF statement. You can find more information about statement coverage in A Study Guide to the ISTQB® Foundation Level 2018 Syllabus, Chapter 4, Section 4.31.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments