Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

What is meant by branch coverage or decision coverage? How is it calculated?

Code Coverage is a very important aspect when it comes to testing, although a number of people may not even have heard about it. It should not be ignored, instead attempts should be made to incorporate it as part of processes. There are practical difficulties – it requires a great deal of effort to understand it and implement it properly, especially when you want your team to implement it. Here we have tried our best to keep the concepts as simple as possible so that you can atleast understand the basics of code coverage.
Code coverage is a measure to determine the extent to which you have tested a certain piece of code of your software program which is under testing, and the higher the coverage, the better. In this article we are going to discuss about one particular type of code coverage called “branch coverage” and how it is calculated. If we talk about Code coverage, it is used as a method to complement the unit testing, since the code coverage also tells us how much code remains to be tested and unit testing just tells us that about the performance of the code that has been tested. The target of a tester should be to achieve 100 percent code coverage (although it gets difficult to get to 100%).
In a software development cycle the code coverage is measured in the terms of statements and branches that are to be tested. One point you should always keep in mind is that achieving 100 percent code coverage does not means that your software system or application is free of bugs and error. It still might be having many critical bugs. Code coverage just gives the extent of how much code has been tested and does not eradicate the bugs and errors. Bugs and errors still persist. Code coverage might deceive you by giving you an illusion of false sense of security. You are wrong if you think that 100 percent code coverage achievement is enough to give you a solid and bug free product.
Branch coverage is a means to just enough give you an indication about the big visible errors and bugs and not about the hidden ones. It helps in discovering bugs and errors which lie unexplored and unexposed in the unexecuted part of the program code. Branch coverage has got another drawback; it is not effective in digging out bugs and errors that are hidden in the interactions between the decisions and their structures. For your information, path coverage is mostly preferred since it is very comprehensive and more robust as compared to the branch coverage technique. Being more robust it helps discover errors and bugs within a short span of time. It is a known fact that branch is the result of a decision.
So to put it simply we can say that the branch coverage gives the measure of the extent to which the outcomes of the decisions in a particular piece of executable code of a program have been tested. Though being less effective than the statement coverage, it is far much better than the simple statement coverage. Now, calculating the number of branches is pretty easy. In a program; for making decisions either Boolean decisions are used or switches are implemented. Boolean decisions, as we all know can have only 2 outcomes i.e., either true or false. The switches result in only one value for each particular case. It is not surprising that the number of branches equals the number of the outcomes of the decisions in a certain piece of code. Don’t forget to add the one branch for every straight line code. The branch coverage for discovering all the errors and bugs doesn’t works and carrying out exhaustive testing on each and every branch is not recommended.

Lessons Learned in Software Testing Software Testing (2nd Edition) Testing Computer Software, 2nd Edition

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>