Software testing foundations homework2
Below are two faulty programs. Each includes a test case that results in failure. Answer the following questions (in the next slide) about each program. public int findLast (int[] x, int y) { //Effects: If x==null throw NullPointerException if (x[i] == y) { return i; } } } public static int lastZero (int[] x) { //Effects: if x==null throw NullPointerException if (x[i] == 0) { return i; } } return -1; } // test: x=[0, 1, 0] // Expected = 2 56 |
Questions |
Identify the fault. fault. (Reachability) If possible, identify a test case that executes the fault, but does not result in an error state. If possible identify a test case that results in an error, but not a failure. Due Date: 23:59:59 March 15. Please send your answer to tjuscsst@qq.com and post it to your blog. |