'Is branch coverage the same as decision coverage?

I'm learning software testing right now, and I found that there are a lot of coverage criterias out there. And something just confused me.

Is branch coverage equals to decision coverage? wiki said it's not the same here, I read the reference document, but I didn't found something such as: branch coverage is not decision coverage, maybe it's because my poor English...

But other tutors all says branch coverage is decision coverage. So can anyone give me a clear answer about this? thanks a lot.



Solution 1:[1]

Not exactly. As ISTQB Foundation book gives, 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.

Decision coverage example:

Hope now It comes clear for you)

Solution 2:[2]

No. Decision coverage and branch coverage are closely-related forms of structural coverage analysis. Decision coverage is referenced by DO-178B/DO-178C whereas branch coverage is referenced by ISO 26262. Branch coverage requires every exit from a conditional source code statement to be executed. Thus, for an if statement, branch coverage requires the then part and the else part to be executed (if there is no else part, the if statement should still execute the decision as true and false). For decision coverage, the DO-178B/DO-178C definition of decision covers conditional statements, in the same way as branch coverage, but it also includes assignments of Boolean variables, for example:

a := b or (c and d); (Ada) a = b || (c && d); (C/C++) In this case, decision coverage would require tests for the above assignment making a both true and false.

Moreover, given the same source code and tests to exercise it, the percentage of coverage reported may be different between branch and decision coverage. For example, if 3 out of the 4 branches of a switch statement are executed, the branch coverage would be reported as 75%, but for decision coverage, a decision is considered covered only if all its branches are covered, so the coverage of the switch statement would be reported as 0%.

source:https://www.rapitasystems.com/difference-between-decision-coverage-and-branch-coverage

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 Pranav Singh