软件测试中的fault,error,failure
问题:给定两段代码,设计fault,error,failure的测试用例。
fault:即引起错误的原因,类似病因。
error:类似疾病引起的内部结果。
failure:类似疾病引起的症状。
代码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
fault:少了i=0的情况。
case1(不执行fault):x为null。
case2(执行fault但不引起error):x为单元素数组{1},y为不为1的数4.没有执行循环体返回-1.
case3(引起error但不引起failure):x为{2,4,6},y为不为x中首元素的数4.执行了循环体但是没有引起错误结果。
代码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
fault:应该从后往前遍历而不是从前往后。
case1(不执行fault):没有,一定会执行for循环中的判断语句。
case2(执行fault但不引起error):x为null。没有执行循环体,返回-1.
case3(引起error但不引起failure):x为{2,4,6},与y对应的元素只能有一个。y为4.执行了循环体但是没有引起错误结果。
软件测试中的fault,error,failure的更多相关文章
- 结对编程2—Fault&Error&Failure
		
学习进度表 点滴成就 学习时间 新编写代码行数 博客量(篇) 学到知识点 第一周 8 0 0 了解软件工程 第二周 10 0 1 博文一篇 第三周 15 0 2 选择项目.调查问卷 第四周 20 80 ...
 - 软件测试作业 - fault error failure
		
给出的题目如下: 我的解答如下: For program 1:1. where i > 0 is the fault , it should be changed to i>= 0 to ...
 - 结对编程--fault,error,failure的程序设计
		
一.结对编程内容: 1.不能触发Fault. 2.触发Fault,但是不触发Error. 3.触发Error,但不触发Failure. 二.结对编程人员 1.周浩,周宗耀 2.结对截图: 三.结对项目 ...
 - 结对项目——fault,error,failure的程序设计
		
一.结对编程内容: 1.不能触发Fault. 2.触发Fault,但是不触发Error. 3.触发Error,但不触发Failure. 二.结对编程人员 1.周宗耀.周浩: 2.结对截图: 三.结对项 ...
 - ST HW2 fault & error & failure
		
Software Testing 3014218128 牛菲菲 Below are two faulty programs. Each includes a test case that result ...
 - 统计分析中Type I Error与Type II Error的区别
		
统计分析中Type I Error与Type II Error的区别 在统计分析中,经常提到Type I Error和Type II Error.他们的基本概念是什么?有什么区别? 下面的表格显示 b ...
 - NDK配置debug环境时:Error:FAILURE: Build failed with an exception
		
Error:FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:ex ...
 - 软件测试中LoadRunner函数中的几个陷阱
		
软件测试 中 LoadRunner 函数中的几个陷阱 1.atof 在 loadrunner 中如果直接用 float f; f=atof("123.00"); lr _outpu ...
 - mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决
		
mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决 最近新装好的my ...
 
随机推荐
- 移动端H5 判断IOS还是Android 平台
			
1.方法 (function($) { var UA = window.navigator.userAgent; if(/Android|HTC/i.test(UA) || !!(window.nav ...
 - 【Oracle】RAC集群中的命令
			
数据库名称:racdb 节点名称:rac3.rac4 注:以下命令均在grid用户中执行 1.查看集群节点的状态: [grid@rac3 ~]$ crsctl check cluster [grid@ ...
 - 接口测试及Postman工具
			
首先,什么是接口呢? 接口一般来说有两种,一种是程序内部的接口,一种是系统对外的接口.系统对外的接口:比如你要从别的网站或服务器上获取资源或信息,别人肯定不会把数据库共享给你,他只能给你提供一个他们写 ...
 - 动态给某一个元素添加active
			
<li class="one_data" data-id='+ navGroup.self_first_nav[i].id +'><a href='+ navG ...
 - THUWC2019 划水记
			
Day -2 在学校呆了inf天之后终于回家了! Day 0 在家无(tui)所(fei)事(mo)事(yu),顺便被拉出去剪了个头发,想写写thusc2017的题也写不动,一直在网上冲浪,到处乱翻以 ...
 - 使用ant design pro搭建项目
			
脚手架搭建 git clone --depth=1 https://github.com/ant-design/ant-design-pro.git my-project 然后 cd my-proje ...
 - webpack学习笔记(4)--webpack.config.js
			
devtool参数 这个参数控制是否生成,以及如何生成source map,已经在官网的doc说明总结了. 下表总结了各个参数和使用的情况 devtool 构建速度 重新构建速度 生产环境 品质(qu ...
 - [CodeForces]786B Legacy
			
线段树优化建图. 建立两棵线段树,其上点的点权分别表示"到达这个区间内所有点的最小花费"和"到达这个区间内任意一个点的最小花费". 对于第一种路直接加边即可 对 ...
 - 马上着手开发ios应用程序
			
https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOSCh/chapters/Introd ...
 - POI 海量数据
			
http://blog.csdn.net/Little_Stars/article/details/8266262