Software testing hw2 -- designing the test case of two programs

 

1、          The first program’s fault is the end condition of for loop. It’s not i > 0, it should i >= 0; Because the index of the array is starting from 0.

The second program’s fault is the start condition of for loop. Because it is looking for the last one, so it should be from the back to find. So the for loop should be  for(int i=x.length-1;i>=0;i--)

2、          To identity a test case that does not execute the fault

①    the first program test case

x=[ ], y=2

②    the, second program test case

x=[ ]

When x is an empty array, both of two programs will not enter the loop. So they do not execute the fault

3、          To identity a test case that executes the fault, but does not result in an error fault.

①     The first program test case

x=[2,3,5] y=3

②     The second program test case

x=[1.0,1]

This way they will go into the loop but they will not result in an error.

4、          To identity a test case that results in an error fault, but not a failure.

①    The first program test case

x=[2,3,5] y=4

②     The second program test case

x=[1,1,1]

This is because the value of the search does not exist, so the expected results and the actual results are the same.

posted @ 2017-02-26 16:47  Jerome文  阅读(122)  评论(0编辑  收藏  举报