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.)

程序1:

public int findLast (int[] x, int y) {
 //Effects: If x==null throw NullPointerException
 // else return the index of the last element
 // in x that equals y.
 // If no such element exists, return -1
 for (int i=x.length-1; i > 0; i--)
 {
   if (x[i] == y) {
     return i; }
 }
 return -1;
}
// test: x=[2, 3, 5]; y = 2
// Expected = 0

答:

1)for循环中循环条件应该是i>=0;

2)当x为零时,运行时直接跳过for循环不执行错误代码;

3)当x中与y相等的元素不是x[0]时,代码运行且不报错;

4)x中只有一个元素时,出现error没有failure。

程序2:

public static int lastZero (int[] x) {

//Effects: if x==null throw NullPointerException

// else return the index of the LAST 0 in x.

// Return -1 if 0 does not occur in x

for (int i = 0; i < x.length; i++)

{

if (x[i] == 0)

{

return i;

}

}

return -1;

}

// test: x=[0, 1, 0]

// Expected = 2

答:

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

2)所有用例都进过错误代码;

3)当x中只有一个元素时,如x = [1]时,虽然运行到了出错代码,但并不会出现错误。

4)当x中只有一个0或没有0时,程序运行出现Error,但没有Failure。

Software Testing hw2的更多相关文章

  1. 101+ Manual and Automation Software Testing Interview Questions and Answers

    101+ Manual and Automation Software Testing Interview Questions and Answers http://www.softwaretesti ...

  2. Exploratory Software Testing

    最近找到去年上半年看过一本关于测试方面书籍的总结笔记,一直放在我的个人U盘里,当时是用Xmind记录的,现在重新整理下分享给大家了! James A.Whittaker [美] 詹姆斯·惠特克(软件测 ...

  3. 软件测试software testing summarize

    软件测试(英语:software testing),描述一种用来促进鉴定软件的正确性.完整性.安全性和质量的过程.软件测试的经典定义是:在规定的条件下对程序进行操作,以发现程序错误,衡量软件质量,并对 ...

  4. 读书笔记-Software Testing(By Ron Patton)

    Software Testing Part I:The Big Picture 1.Software Testing Background Bug's formal definition 1.The ...

  5. software testing

    Software Testing Software testing is the process of evaluation a software item to detect differences ...

  6. Software Testing Techniques LAB 02: Selenium

    1. Installing 1. Install firefox 38.5.1 2. Install SeleniumIDE    After installing, I set the view o ...

  7. 探索式软件测试—Exploratory Software Testing

    最近找到去年上半年看过一本关于测试方面书籍的总结笔记,一直放在我的个人U盘里,当时是用Xmind记录的,现在重新整理下分享给大家了! James A.Whittaker [美] 詹姆斯·惠特克(软件测 ...

  8. FW:Software Testing

    Software Testing Testing with a Purpose Software testing is performed to verify that the completed s ...

  9. 《The art of software testing》的一个例子

    这几天一直在看一本书,<The art of software testing>,里面有一个例子挺有感触地,写出来和大家分享一下: [问题] 从输入对话框中读取三个整数值,这三个整数值代表 ...

随机推荐

  1. 【学习笔记】Y2-1-1 Oracle数据库基础

    Oracle 简介关系型(二维表)数据库 用来存储海量数据在大数据量的并发检索的情况下,性能要高于其他同类数据库产品一般运行环境是Linux和UnixOracle版本中的I(Internet) G(G ...

  2. Python列表切成多个

    li = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] #arr是被分割的list,n是每个chunk中含n元素. def chunks(arr, n) ...

  3. EF 连接MySQL 数据库  保存中文数据后乱码问题

    EF 连接MySQL 数据库  保存中文数据后乱码问题 采用Code First 生成的数据库,MySQL数据库中,生成的表的编码格式为***** 发现这个问题后,全部手动改成UTF8(图是另一个表的 ...

  4. HandlerThread源码分析

    其实原本HandlerThread的分析不应该单独开一篇博客的,应该在讲消息机制的那一片中一起分析. 但当时忘记了,而且今天第一次用MarkDown写博客,有点上瘾,就再来一篇,权当滥竽充数过过手瘾. ...

  5. SqlServer2008 无法修改表,超时时间已到 在操作完成之前超时解决方法

    在 SQL Server Management Studio 里, 通过菜单“工具-选项”打开选项对话框. 在左侧寻找“设计器-表设计器和数据库设计器”, 然后在右侧勾选“为表设计器更新重写连接字符串 ...

  6. 关闭ctrl+shift+d截图

    关闭ctrl+shift+d截图,最近用sublime text3的时候,用ctrl+shift+d,总是跳出来截图,找了半天,原来是百度浏览器的截图功能快捷键是ctrl+shift+d, 关掉即可

  7. CSS浏览器兼容问题总结

    为什么会出现浏览器兼容问题? 由于各大主流浏览器是不同的厂家开发的,所以使用的核心也不相同,架构代码很难重合,就会产生各种各样的bug. IE6中常见的css解析bug 1)默认高度(IE6)部分块元 ...

  8. lphp输出控制output controll(header, ob_xxx)

    关于php的output controll参考文档: http://gywbd.github.io/posts/2015/1/php-output-buffer-in-deep.html http:/ ...

  9. WebApi Put方法出现MethodNotAllowed解决方法

    WebApi Put方法提交数据的时候总提示MethodNotAllowed,在网上查了很多资料才发现是因为IIS安装了一项服务“WebDAV”,在IIS中把“WebDAV”前面的勾去掉,重新启动电脑 ...

  10. Spring RestTemplate: 比httpClient更优雅的Restful URL访问, java HttpPost with header

    { "Author": "tomcat and jerry", "url":"http://www.cnblogs.com/tom ...