a) Draw the control flow graph for the printPrimes() method.
a) Consider test cases t1=(n=3) and t2=(n=5). Although these tour the same prime paths in printPrimes(), they do not neccessarily find the same fault. Design a simple fault that t2 would be more likely to discover than t1 would.
If we change the first for in the while loop “i++” to “i+=2”. In test case, we can get the right answer 2, 3, 5. But in test case2, we get the result 2,3,5,6,7, it’s wrong. Because , it escape the 3 when check 6. This is the fault that t2 would be more likely to discover than t1 would.
b) For printPrimes(), find a test case such the corresponding test path visits the edge that connects the beginning of the while statement to the for statement without going through the body of the while loop.
The test case is case=(n=1).
c) Enumerate the test requirements for node coverage, edge coverage, and prime path coverage for the graph for printPrimes().
Prime path:
1 2 3 4 5 7 8 9 10 11 13
1 2 3 4 5 7 9 10 11 13
1 2 3 4 8 9 10 11 13
1 2 10 11 13
11 12 11
4 5 6 4
2 3 4 5 7 8 9 2
2 3 4 5 7 9 2
2 3 4 8 9 2