软件测试-HomeWork2

——软件测试中的fault、error、failure示例

如上面两个小程序中,分析下列问题:

 1、Identify the fault.

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

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

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

(图左边称为program1、右边称为program2)

1.program1 for循环里i没有遍历到数组里第一个数
   program2 for循环是从前往后循环,应该从后往前循环,因为是找最后一个0

2.program1:当x==null的时候不执行fault 如 x==null y=3
   program2:不存在,就算x==null也会执行for循环,i=0

3.program1: 当数组x的第一个元素不是唯一与y相等的元素即可
   如 x=[1,3,1,5],y=1
   program2: 当x==null时回执行fault不会导致error
4.program1:当x中只有一个元素会触发error,但是如果这个元素与y不相等则不会发生 failure,如x=[9],y=7
   program2:当x非空而且只有一个元素为0或者x中没有为0的元素时
   如x=[2,0]或者x=[2,3]

posted @ 2018-03-12 20:20  ANJINA  阅读(126)  评论(1)    收藏  举报