How many test cases are needed to achieve 100 per cent decision coverage?

End

How many test cases are needed to achieve 100 per cent decision coverage?
A . 1
B . 2
C . 3
D . 4

Answer: B

Explanation:

Decision coverage is a structure-based test technique that involves testing every decision point in the code by testing all possible outcomes or branches of each decision point. Decision coverage requires some knowledge of the internal structure or implementation of the software system; it focuses on how the system does what it does rather than what it does.

The pseudo code given in the question has one decision point at line 4, where the value of Gender is compared to ‘female’.

This decision point has two possible outcomes or branches:

True branch: If Gender = ‘female’, then print “Ms” at line 5.

False branch: If Gender!= ‘female’, then print “Mr” at line 7.

To achieve 100 per cent decision coverage, we need to test both outcomes or branches of the decision point at least once.

Therefore, we need two test cases that cover both scenarios:

TC1: Gender = ‘female’ -> Print “Dear Ms”

TC2: Gender = ‘male’ -> Print “Dear Mr”

The other options are not correct because they do not provide enough or too many test cases to achieve 100 per cent decision coverage.

For example:

A: 1: This option is not enough because it only provides one test case that covers one outcome or branch of the decision point, but not the other.

C: 3: This option is too many because it provides three test cases that cover both outcomes or branches of the decision point, but one of them is redundant or unnecessary.

D: 4: This option is too many because it provides four test cases that cover both outcomes or branches of the decision point, but two of them are redundant or unnecessary.

You can find more information about decision coverage and structure-based testing in [A Study Guide to the ISTQB® Foundation Level 2018 Syllabus], Chapter 4, Section 4.3.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments