130 likes | 204 Views
What is an “Error”?. According to IEEE Standard Glossary: ________: The difference between a computed, observed, or measured value or condition and the true, specified, or theoretically correct value or condition
E N D
What is an “Error”? According to IEEE Standard Glossary: • ________: The difference between a computed, observed, or measured value or condition and the true, specified, or theoretically correct value or condition • For example, a difference of 30 meters between a computed result and the correct result Error Fault • ________: An incorrect step, process, or data definition • For example, an incorrect instruction in a computer program.
What is an “Error”? Failure • ________: An incorrect result • For example, a computed result of 12 when the correct result is 10 Mistake • ________: A human action that produces an incorrect result • For example, an incorrect action on the part of a programmer or operator.
Statement CoverageExample 1 if (a >= 0 && a <= 9) sum = list1[a]; if (b >= 0 && b <= 9) sum = sum + list2[b]; • Statement coverage may be achieved by 1 test case(s): • a = 9, b = 3.
Branch CoverageSame Example 1 if (a >= 0 && a <= 9) sum = list1[a]; if (b >= 0 && b <= 9) sum = sum + list2[b]; • Branch coverage may be achieved by 2 test cases: • a = 9, b = 3 • a = 10, b = –1 sumis not defined.
Branch CoverageExample 2 if (a >= 0 && a <= 9) sum = list1[a]; else sum = 0; if (b >= 0 && b <= 9) sum = sum + list2[b]; else sum = 0; • Branch coverage may be achieved by 2 test cases: • a = 9, b = 3 • a = 10, b = –1.
Path CoverageSame Example 2 if (a >= 0 && a <= 9) sum = list1[a]; else sum = 0; if (b >= 0 && b <= 9) sum = sum + list2[b]; else sum = 0; • Path coverage may be achieved by 4 test cases: • a = 9, b = 3 • a = 10, b = –1 • a = 10, b = 3 • a = 9, b = –1 sumis not correct.
Branch CoverageExample 3 if (a >= 0 && a <= 9) sum = list1[a]; else sum = 0; if (b >= 0 && b <= 9) sum = sum + list2[b]; else sum = 0; ... if (z >= 0 && z <= 9) sum = sum + list26[b]; else sum = 0; • Branch coverage may be achieved by 2 test cases.
Path CoverageSame Example 3 if (a >= 0 && a <= 9) sum = list1[a]; else sum = 0; if (b >= 0 && b <= 9) sum = sum + list2[b]; else sum = 0; ... if (z >= 0 && z <= 9) sum = sum + list26[b]; else sum = 0; • Path coverage may be achieved by 226 test cases.
Path CoverageSame Example 3 • Path coverage may be achieved by 226 test cases 67,108,864 • If the execution of a test case takes 1 second, this will take 2.13 years.
Statement CoverageExample 4 sum = 0; while (a >= 0 && a <= 9) { sum = list1[a]; a = a + 1; }; if (b >= 0 && b <= 9) sum = list2[b]; else sum = 0; • Statement coverage may be achieved by 2 test cases: • a = 9, b = 3 • a = 9, b = 10.
Branch CoverageSame Example 4 sum = 0; while (a >= 0 && a <= 9) { sum = list1[a]; a = a + 1; }; if (b >= 0 && b <= 9) sum = list2[b]; else sum = 0; • Branch coverage may be achieved by 2 test cases: • a = 3, b = 9 • a = 3, b = 10.
Path CoverageSame Example 4 sum = 0; while (a >= 0 && a <= 9) { sum = list1[a]; a = a + 1; }; if (b >= 0 && b <= 9) sum = list2[b]; else sum = 0; Path coverage may be achieved by 22 test cases: Path coverage may take infinite number of test cases if the loop does not have fixed upper or lower bounds. • a = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and b = 9, 10.
Loop CoverageSame Example 4 sum = 0; while (a >= 0 && a <= 9) { sum = list1[a]; a = a + 1; }; if (b >= 0 && b <= 9) sum = list2[b]; else sum = 0; • Loop coverage may be achieved by 6 test cases: Is this correct? • a = 10 • a = 9 • a = 8 sumis not correct. • a = 1 • a = 0 • a =–1