If you have a section of code that has one simple IF statement, how many tests will be needed to achieve 100% branch coverage?
Các đáp án
Đáp án đúng
B: 2
Giải thích
B is correct. A simple IF statement will be composed of If ... then ... else.... end if. There are two branch outcomes, one for the result of the If being true and one for it being false. Since 100% branch coverage requires at least one test case for each branch outcome, two tests are needed. A and C are incorrect because these are the wrong numbers of tests. D would be correct if this weren’t defined as a simple if statement because a complex if statement could include more than two outcomes.