Decision coverage is also called branch coverage or modified coverage and sometimes it is also called as all edges coverage. It process both true and false conditions which is considered as statement coverage. Conceptually, a branch is an outcome of decision, in this context, a branch coverage measures what number of decisions should be tested. This process of covering branches acts as an advantage because it executes in-depth source code analysis for better outcome.
It is also known by a testing approach, the major aim is to ensure that each of the possible number of branches from a particular decision point should be executed at least once. And lastly, there should be a validation check to ensure all the branches have been covered.
Ultimately, this valuable process defines the behaviour of the application. In this coverage, the decision is in the form of If statement or loop control statement such as do-while or repeat-until or case statement.
Decision condition coverage or modified condition coverage increases the condition criteria that shown in their independent outcome. The designing strategy requires more thoughtful effort for selection of test cases which is carried out from integrated components.
The basic calculative formula is given below:
Decision Coverage = (Number of decision outcomes exercised / Total number of decision outcomes) *100
Many times, it may be seen that decision coverage requires an independent outcome in the form of true and false. To achieve complete coverage, it is necessary to follow descriptive methods appropriately. As a whole, it can be observed that 100% decision coverage ensures 100% statement coverage.
IF A + B > 10 then
PRINT "A + B is Large"
IF A > 5 then
PRINT "A Large"
The above flow chart diagram shows a qualitative approach to functions a value from top to bottom. Each directed link holds a different value such as 1, 2, 3, 4 and 5 of A, B, C, D, E, F, G, H. To calculate branch coverage, it is important to find minimum number of paths which are such as:
Therefore, the final decision coverage is 2.
It can be noted that 100% of decision coverage guarantees 100% statement coverage. But it 100% of statement may not guarantee 100% of decision coverage.