软件测试作业二

1.

 

 

In this program if we test the data x = [2,3,5];y = 2. We will get the output -1; This is a fault; The reason is that  we can not reach the first element. The right conditional statement should be i >= 0;

 

A test case without fault is x=null;

A test case execute the fault but do not reach the error is x={2,3,5},y=5;

A test case leads to an error but not a failure is x={2,3,5},y=1;

 

2.

 

 

 

 

 

This program is going to find the first 0, not the last; The right conditional statement should be (int i=x.length -1; i>=0; i-- );

 

 

A test case without fault is x=null;

A test case execute the fault but do not reach the error is x={0};

A test case leads to an error but not a failure is x={1,2,3};

posted @ 2017-03-03 12:30  huangyuanqi  阅读(119)  评论(0)    收藏  举报