QA Fundamentals · Middle · Question 10 of 75

Why is branch coverage stronger than statement coverage?

if (isVip) price = price * 0.9;
return price;
Show the answer

Correct answer: It requires both the true and the false outcome to run

Explanation

One test with isVip = true runs every line here (100% statements) but never tests the path where the discount is skipped. Branch coverage needs both.

Further reading

Problem with a question

QA Fundamentals · Middle · question 10

Test yourself

Take the QA Fundamentals · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz