Quality Testing

Quality is delighting customers

Statement coverage Branch coverage and Decision coverage


Please explain.....

Given the following code

•int f1(int x, int y){
•while (x != y){
• if (x>y) then
• x=x-y;
• else y=y-x;
• } }

* How minimum testcases are required to acheive 100% statement and branch coverage ? . Please explain me in detail .

Also what is the difference between branch coverage and decision coverage ?


Views: 21874

Reply to This

Replies to This Discussion

Dear Swapupa,

Please find attached the following pdf file.
Hope it clears your doubts.

If not, feel free to revert back
at prajkta.narkar@gmail.com.


this is sasikumar,

i am working at functional testing at chennai. i am not able to understand about this, can you explain me briefly.

thanks with regards,

PraNa's attachment gives good advice on computing the size of covering sets for statement and decision coverage, Swarupa, but implies that branch coverage and decision coverage are the same thing. For ISTQB exam purposes, this may be taken to be true, but the reality may be different, depending on your definition of branch.

A resource underlying ISTQB's Foundation Syllabus (and explicitly used in the Advanced Syllabus) is the the British Standard on Component Testing, BS 7925-2. This document discusses 13 test techniques, with worked examples. Unfortunately, the discussion of branch coverage is marred by the authors' having used three incompatible definitions of branch.

Clause 3.7.1 defines branch to mean the same as decision outcome, and branch coverage is computed as decision coverage. Therefore, by this definition, branch coverage is the same as decision coverage at all levels of coverage (up to and including 100%).

BS 7925-2 Clause 4.7.1 uses the definition of branch provided in the accompanying Standard Glossary, BS 7925-1. Like the definitions of branch in IEEE 610.12 and the ISTQB Glossary, this definition includes "unconditional branches" such as free-standing GOTO, CALL,etc., as well as "conditional branches" such as IF/ELSE, SWITCH/CASE, WHILE and UNTIL, etc. Under this definition, branch coverage and decision coverage may be quite different at any coverage level, but in particular, 100% branch coverage "subsumes" (includes) 100% decision coverage. This means that when you've got 100% branch coverage, you are guaranteed to have 100% decision coverage; but 100% decision coverage doesn't guarantee 100% branch coverage. This is because (by these standard definitions) the term “branch” includes control flow mechanisms that are not “decisions”. Therefore (and despite statements in BS 7925-2 and ISTQB's Advanced Syllabus), branch coverage may exceed decision coverage at the 100% level.

By the "official" definitions of branch in BS 7925-2, IEEE 610.12, and the ISTQB Glossary, therefore, branch and decision outcome are not the same thing, and "branch coverage" may include code that "decision coverage" will miss, though only in algorithms that have multiple entry points. (As an aside, this also means that it's possible to achieve 100% decision coverage without having achieved 100% statement coverage. BUT YOU SHOULD IGNORE THAT FACT FOR ISTQB EXAM PURPOSES.)

ISTQB's Advanced Syllabus claims that "decision and branch testing are the same at 100% coverage but can be different at lower coverage levels”. This statement is quoted from BS 7925-2 Annex B.7, which uses a third (but inexplicit) definition, in which a branch is not a control flow statement in an algorithm, but a link (or edge--i.e., a connecting line) in a control flowgraph. In the flowgraph used to illustrate (Figure B-7), the link between nodes B1 and B2 is counted as a branch, but represents a simple fall-through from one executable statement to the next in sequence. The BS 7925-1 definition of branch explicitly excludes fall-throughs from consideration as branches. BS 7925-2 clause 3.7.1, IEEE 610.12, and the ISTQB Glossary definitions implicitly do the same.

The other links in Figure B.7 all correspond to decision outcomes. Because (in this case) a fallthrough is erroneously counted as a branch, decision and branch testing in the example, “are the same at 100% coverage but different at lower coverage levels”. But without the inclusion of a fall-through as a branch, branch would be exactly equivalent to decision outcome, and branch coverage and decision coverage of the flowgraph (and algorithm) would be identical at all coverage levels.

How important it is to define your terms before using them!" Unfortunately, the ISTQB practice is to write a syllabus, then retroactively create Glossary entries that don't always agree with what the syllabuses say.

Good luck with the exam, Swarupa, and remember: for exam purposes, branch coverage is the same as decision coverage ...

-- Don
Hi Don,

Thankyou for such a good explanation.But after completing my foundation level i will go to the advanced level also .Could you please provide me the pdf of the book u have mentioned here so that i can see the Figures you have mentioned in the above material and get complete understanding of the topic.

Thnakyou for the wishes.


Hi Don,


Plzz provide the materials for ISTQB..what ever you have..


Thanks in advance....



TTWT Magazine





© 2018   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service