Software Testing hw2
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的更多相关文章
- 101+ Manual and Automation Software Testing Interview Questions and Answers
101+ Manual and Automation Software Testing Interview Questions and Answers http://www.softwaretesti ...
- Exploratory Software Testing
最近找到去年上半年看过一本关于测试方面书籍的总结笔记,一直放在我的个人U盘里,当时是用Xmind记录的,现在重新整理下分享给大家了! James A.Whittaker [美] 詹姆斯·惠特克(软件测 ...
- 软件测试software testing summarize
软件测试(英语:software testing),描述一种用来促进鉴定软件的正确性.完整性.安全性和质量的过程.软件测试的经典定义是:在规定的条件下对程序进行操作,以发现程序错误,衡量软件质量,并对 ...
- 读书笔记-Software Testing(By Ron Patton)
Software Testing Part I:The Big Picture 1.Software Testing Background Bug's formal definition 1.The ...
- software testing
Software Testing Software testing is the process of evaluation a software item to detect differences ...
- Software Testing Techniques LAB 02: Selenium
1. Installing 1. Install firefox 38.5.1 2. Install SeleniumIDE After installing, I set the view o ...
- 探索式软件测试—Exploratory Software Testing
最近找到去年上半年看过一本关于测试方面书籍的总结笔记,一直放在我的个人U盘里,当时是用Xmind记录的,现在重新整理下分享给大家了! James A.Whittaker [美] 詹姆斯·惠特克(软件测 ...
- FW:Software Testing
Software Testing Testing with a Purpose Software testing is performed to verify that the completed s ...
- 《The art of software testing》的一个例子
这几天一直在看一本书,<The art of software testing>,里面有一个例子挺有感触地,写出来和大家分享一下: [问题] 从输入对话框中读取三个整数值,这三个整数值代表 ...
随机推荐
- js鼠标经过文字滚动,移开还原
不说别的,直接贴代码. <div class="kj-scroll" id="countrylist0" onmouseover="wPAa = ...
- oracle 脱敏和加密
脱敏:在此只是对数据如姓名,身份证号码等进行简单粗暴的脱敏,即改变数据 针对于number类型的数据:update table_name set conlunm_name = substr (co ...
- win10使用小技巧以及常见问题处理方案
1.win10开机一直处于黑屏状态或者反复重启怎么处理? 处理小方法:开机按win+X组合件进入高级修复模式---选择修复开启模式---f4进入安全模式开机状态---管理控制面板---禁用或者卸载显卡 ...
- 【总结】清除webbrowser cookie/session的6种方法
下面是我测试下来的6种清除webbrowser中cookie的6种方法: //方法一:调用 wininet.dll清除cookie (推荐) SuppressWininetBehavior(); // ...
- ABAP 读取EXCEL文件到内表
1.选择excel文件: PARAMETERS: P_FILE LIKE RLGRAP-FILENAME OBLIGATORY. AT SELECTION-SCREEN ON VALUE-REQUES ...
- varnish
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,bi ...
- Sanarus公司的Cassi微创乳房活检设备投入使用
这种新型可转动的大核心乳房活检设备,是一种全自动一次性的手工操作的设备.该设备对乳房造成的创伤最小,是传统乳房活检设备很好的替代选择. 该设备被称作Cassi,操作方便而且无需准备时间.无需固定设备的 ...
- workflow GetListIdByName 获取表名
1.Assign 获取表的地址 和表名 2.HttpsendWithSuspend==HttpSend 3.ParseDynamicValue 4.GetDynamicValuePropertie ...
- 关于C++的递归调用(n的阶乘为例)
C++,是入门编程界的一门初期的语言.今天我们浅谈一下有关C++的递归调用. 在没有继承,多态,封装之前,C++几乎看成是C语言,除了一些简单的输出和头文件. 具体代码实现如下: #include&l ...
- [06]APUE:系统数据文件和信息
[a] getpwent / setpwent / endpwent #include <pwd.h> struct passwd *getpwent(void) //成功返回指针,出错或 ...