Branch Testing is the testing in which all the branches included in the program source code are tested at least once.
Branch testing is also known as the structural or white box testing because it is only related with the source code and not with the internal working of application. Branch testing is also known as the decision testing.
In this branch testing each and every statement of the code is executed at least once. In Branch testing all the branches in the source code are validated so that any abnormal behavior of branch should not stop the working of an application.
Decision testing includes loop statement, CASE statement, IF statement where there are two or more outcomes, the outcomes can be true or false.
How to calculate the Branch/Decision coverage?
To calculate decision coverage find out the minimum number of paths covering all the edges.
Branch Testing = (Number of decision outcomes tested / Total number of decision outcomes) x 100 %
If x + y > 20 THEN
Print “x + y is large”
Print “x is large”
Consider the above given example.
The Branch coverage is: