Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

Here's the problem in a nutshell:

if ((test1() || test2()) {
else {

Suppose you have two test cases:

  • test1() evaluates to true, and
  • Both test1() and test2() evaluate to false.

Some code coverage tools will yield 100% coverage because these two test cases result in the execution of every statement. The problem is that every path has not been tested. This code needs three test cases, one more for the case where test1() evaluates to false but test2() evaluates to true.

In this hypothetical example, that third critical test case would expose that latent bug. If you fail to provide that third case and use a coverage tool based solely on statement executions you will get a false sense that testing is complete.

share|improve this answer

If you think about your program as a big directed graph with a start node going to one or more end nodes. Each statement in your program is a node on the graph, branches or decisions are edges between nodes.

Full statement coverage is when you visit every node in the graph at least once, full branch/decision coverage is when you traverse every edge in the graph at least once (and I think they are the same thing).

Neither of these is necessarily the same as Full path coverage, when you traverse every path from the start node to every end node.

As with any terminology there is no guarantee that everyone means exactly the same thing by the same term. Wikipedia seems to take branch coverage to mean modified decision coverage but there are plenty of other sources, as you note, that say they are the same. What we can say more authoritatively is that statement coverage is not the same as branch coverage, and neither are the same as path coverage.

If you need to use these terms then your best bet is to define what you mean by them before you use them.

For point 2. Coverage metrics can be used on any form of testing, it is certainly fairly common to use it on unit tests and on automated system/integration tests

share|improve this answer
But you have said branch/decision while they are not the same thing (according to e.g. Wikipedia). That is what I am asking. – user970696 Jan 25 '13 at 13:02
I can imagine a[n admittedly poorly designed] system where there are two edges from one statement to the next. In such a case, if one traverses only one edge then they have statement coverage but not branch coverage. They may be functionally the same (in most cases, at least) but there is a distinction. – acattle Jan 25 '13 at 13:02
this is essentially an issue of descriptive terminology. some people define BC and DC as the same thing some people define BC and DC as slightly different things. They are essentially BOTH right. – jk. Jan 25 '13 at 14:15
I have updated the question so the difference is visible there. – user970696 Jan 25 '13 at 14:25
If you want to use that as a definition that is fine, use that. Just be aware that many people will use the two terms interchangeably. Given that definition usually come from use rather than authority both are correct as I have said. – jk. Jan 25 '13 at 14:30

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.