Professional Documents
Culture Documents
Coverage types
1) 2) 3) 4) 5) Statement coverage Branch coverage Path coverage LCSAJ coverage Condition coverage
(i) Basic conditions coverage (ii) Modified condition / Decision coverage
Statement coverage
Every statement of the program should be exercised at least once Eg 1. Main() { Int a,b; Scanf(%d%d,&a,&b) Printf(a is big); Ptintf(b is big); } How many test case required to cover the statement?
Path coverage
Every execution path of the program should be exercised at least once.
LCSAJ coverage:
A Linear Code Sequence And Jump, consisting of the following three items (conventionally identified by line numbers in a source code listing): the start of the linear sequence of executable statements, the end of the linear sequence, and the target line to which control flow is transferred at the end of the linear sequence.
Condition coverage
Each condition in a branch is made to evaluate to true and false at least once (Basic condition). All possible combinations of condition outcomes within each branch should be exercised at least once (MC/DC).
Condition coverage Modified condition / Decision coverage (MC/DC)
How many number of test cases required for statement , Branch, Basic condition and MC/DC coverage?
void main(void) { int a, b, c; scanf("%d %d %d", a, b, c); if ((a > 1) && (b == 0)) b = c / a; if ((a == 2) || (c > 1)) c = c + 1; while (a >= 2) a = a - 2; printf("%d %d %d", a, b, c); }
Conclusion
branch coverage implies both 100% decision coverage and 100% statement coverage 100% LCSAJ coverage implies 100% decision coverage. 100% decision coverage implies both 100% branch coverage and 100% statement coverage.
Thank you