【软件测试】作业二:fault & error & failure

REVIEW:

Software Fault: A static defect in the software;(eg: virus)

Software Failure: External, incorrect behavior with respect to the requirements or other description of the expected behavior;( eg: high body temperature)

Software Error: An incorrect internal state that is the manifestation of some fault;(eg: some symptoms)

Reachability: The location or locations in the program that contain the fault must be reached

Infection: The state of the program must be incorrect

Propagation: The infected state must cause some output or final state of the program to be incorrect
Software Testing Techniques

 

HOMEWORK:

1.Identify the fault.

(1) 'i > 0' should be 'i >= 0';

(2) it returns to the first '0' but not the last '0', I have 2 ways to correct it:

#1:

int k = -1;
for (int i= 0; i< x.length; i++)
{
    if (x[i] == 0)
    {
        k = i;
    }
} 
return k;

#2:

for (int i= x.length - 1; i >= 0 ; i--)
{
    if (x[i] == 0)
    {
        return i;
    }
} return -1;    

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

(1) Test case: x = null.

(2) It always execute the fault.

 

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

(1) Test case: x = [1,2,3 ]; y = 3; Expected: 2; Actual: 2.

(2) It's impossible.

 

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

(1) Test case: x = [1,2,3 ]; y = 4; Expected: -1; Actual: -1.

(2) Test case: x = [1,2,0 ]; Expected:2; Actual:2.

转载于:https://www.cnblogs.com/3013218071zjr/p/5249791.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值