Testing – Branch vs Decision Coverage

qualitytest-coveragetesting

ISTQB does not distinct between these (it reads "Branch/decision coverage") but some sources do say it is different.
I would have two question. The essential one is about the difference. And the other one – does this whole concept belongs under the unit testing? Or white box testing?
Thanks

From the ISTQB:

branch coverage is closely related to decision coverage and at 100%
coverage they give exactly the same results. Decision coverage
measures the coverage of conditional branches; branch coverage
measures the coverage of both conditional and unconditional branches.
The Syllabus uses decision coverage, as it is the source of the
branches. Some coverage measurement tools may talk about branch
coverage when they actually mean decision coverage. (c) ISTQB
foundation book.

Best Answer

The branch is an optionnal execution path, whereas a decision is the result of a combination of conditions (i.e. a boolean expression).

Thus, there can be decision without branch. For example:

int fun(int a, int b){
   return (a > 5) && (b < 15);
 }

In the above function, "(a > 5)" is a condition, "(b < 15)" is another condition. "(a > 5) && (b < 15)" is a decision. And there is no branch.

Thus in this example, the decision coverage will be reached with only 2 tests, and the branch coverage on source code reach 100% with a single test.

Branch coverage at assembly level would require the same two tests, but the question become tricky if you write the function like this:

int fun(int a, int b){
   return (a > 5) & (b < 15);
 }

There is still a boolean decision (computed with arithmetic operations) and the assembly would not have branches.

Nasa handbook on MCDC measurement clarify this type of differences. http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20040086014_2004090420.pdf