Coverage is simply a measurement which gives the information about, how much the test case has been exercised.
The different types of coverage techniques are discussed below:
1) Statement coverage: The main advantage of this statement coverage is to identify which blocks of code has been executed in a method or a class.
2) Decision coverage: This is also known as Branch coverage. There will be two outcomes(True/False) for any of the statements like IF/DO-WHILE/CASE. This technique will ensure the outcome should be executed atleast once.
The formula to calculate decision coverage is:
Decision Coverage=(Number of decision outcomes executed/Total number of decision outcomes)*100%
3) Path coverage: In this technique, the test case is executed atleast once in such a way that every path is executed atleast once including all loop paths taken zero, once, and multipe.
Asked In: Many Interviews |