This technique aims to cover the various conditions and its consecutive flow. A condition or predicate when evaluates to true must execute the next relevant line of code that follows. This can be explained with the help of an example.
print "execute this line";
print "executing else statement";
The above pseudocode checks the if condition, if it evaluates to be true, the next statement should execute else the print statement inside else. Ideally this flow is normal, if there is any deviation in this, that must be identified using test cases.
Branch Coverage technique involves checking whether every possible path or branch is covered. Branching is actually a jump from one decision point to another. The concept can be further elucidated with the help of an example.
print "a is largest"
print "Both a and b are equivalent"
print "b is largest number"
If the first condition evaluates to true then the first print statement is printed, if the first becomes false the program must jump to the second else if and print the statement under that. Branch coverage is simply checking a decision point and moving further accordingly, from one decision point to another, whichever relevant. Branch coverage is often calculate using the following formulae -
Branch Testing = (number of decision outcomes tested/total number of decision outcomes)*100
Coverage technique offers a way to verify the various points at which a program may tend to behave abnormally or simply terminate. These coverage techniques also helps us to measure to what extent our program is successfully running and how is it handling errors, if any.
Therefore coverage techniques are a great way to analyse and present the functioning of program in the light of specifications.