软件测试[2]falut error failure 的区别与理解

Fault的定义可能导致系统或功能失效的异常条件(Abnormal condition that can cause an element or an item tofail.),可译为“故障”
Error的定义计算、观察或测量值或条件,与真实、规定或理论上正确的值或条件之间的差异(Discrepancy between a computed, observed or measured value or condition and the true, specified, or theoretically correct value or condition.),可译为“错误”。Error是能够导致系统出现Failure的系统内部状态

Failure的定义:当一个系统不能执行所要求的功能时,即为Failure,可译为“失效”。(Termination of the ability of an element or an item to perform a function as required.)

 

 

下面是我们第二次作业的实例分析

Below are four faulty programs. Each includes a test case that results in failure. Answer the following questions (in the next slide) about each program.

 

对于问题1

(1)判断条件应该为i >=0;当数组的下标为0时,也要判断。

(2)要找出最后一个0的下标,应该从后往前找,for循环可以这样改for(int i=x.length-1;i>=0;i--)

问题2

(1)不执行falut代码,x为空数组

(2)x为空数组

问题3

(1)执行falut代码,但是不出现error x = [1,2,3] y=2;

(2)x=[1,1,0] 

问题4

老是我分不清error和failure的区别,这题不会做。希望老师上课可以再讲讲。

 

posted @ 2016-03-09 22:54  郭松  阅读(631)  评论(0编辑  收藏  举报