软件测试homework2

程序一:

A.Identify the fault

应该是i>=0,而不是i>0,for(int i=x.length-1;i>=0;i++)

B.If possible, identify a test case that does not execute the fault. (Reachability)

x=[];抛出空指针异常

C.If possible, identify a test case that executes the fault, but does not result in an error state

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

期望输出为1

实际输出为1,没有error

D.If possible identify a test case that results in an error, but not a failure.

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

期望输出为-1

实际输出为-1,但是有error

程序二:

A.Identify the fault

应该是for(int i=x.length;i--;i>0)

B.If possible, identify a test case that does not execute the fault. (Reachability)

x=[];抛出空指针异常

C.If possible, identify a test case that executes the fault, but does not result in an error state

x=[1,2,0]

期望输出为2

实际输出为2

D.If possible identify a test case that results in an error, but not a failure.

x=[0,1,0]

期望输出为2

实际输出为0

posted @ 2018-03-16 12:46  孙晴SQ  阅读(77)  评论(0编辑  收藏  举报