实验四(白盒测试)_第1页
实验四(白盒测试)_第2页
实验四(白盒测试)_第3页
实验四(白盒测试)_第4页
实验四(白盒测试)_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、软件测试计划测试目的1. 练习和掌握软件测试管理的一般过程与步骤;2. 掌握测试管理的人工过程和能够通过相关管理软件实现以下工作:a) 配置软件资产信息、软件需求、软件模型和缺陷数据库;b) 创建和管理多个测试组和用户;c) 配置测试环境、编写详细测试计划、安排测试进度;d) 设计测试脚本、测试用例;e) 实施测试、执行测试和评估测试。测试选题对PriorDate程序(计算当前输入日期的前一天)的测试。测试人员何:软件测试计划及相关资料的编写与收集。侯:对特定问题编写程序代码,并对其进行黑盒测试。金:对特定问题编写程序代码,并对其进行白盒测试。测试方法使用白盒测试技术,测试内容包括语句覆盖测试

2、、分支覆盖测试、条件覆盖测试、分支/条件覆盖测试、条件组合覆盖测试及基本路径测试。测试资料白盒测试 测试规划基于产品的内部结构进行测试,检查内部操作是否按规定执行,软件各个部分功能是否得到充分使用,则这种测试方法称为白盒测试(White-box Testing)方法。 白盒测试又称为结构测试、逻辑驱动测试或基于程序的测试,一般用来分析程序的内部结构。 白盒测试将被测程序看作一个打开的盒子,测试者能够看到被测源程序,可以分析被测程序的内部结构,此时测试的焦点集中在根据其内部结构设计测试用例。 白盒测试要求是对某些程序的结构特性做到一定程度的覆盖,或者说这种测试是“基于覆盖率的测试”。 通常的程序

3、结构覆盖有: 语句覆盖 判定覆盖 条件覆盖 判定/条件覆盖 路径覆盖软件测试过程单元测试:针对每个单元的测试, 以确保每个模块能正常工作为目标。集成测试:对已测试过的模块进行组装,进行集成测试。目的在于检验与软件设计相关的程 序结构问题。确认(有效性)测试:是检验所开发的软件能否满足所有功能和性能需求的最后手段。系统测试:检验软件产品能否与系统的其他部分(比如,硬件、数据库及操作人员)协调 工作。验收(用户)测试:检验软件产品质量的最后一道工序。主要突出用户的作用,同时软件开 发人员也应有一定程度的参与。数据整理测试所得到的用例测试报告、BUG报告,需要进行反馈和最后的归档,归档的工作按照项目

4、计划中所规定的内容进行,反馈的工作在测试项结束后,整理成测试总结报告后进行,具体的日期,在项目计划中有规定。不同阶段的测试,都需要重复以上的步骤。其他必要的数据整理的工作,由项目经理在进行过程中进行安排。PriorDate程序测试报告(白盒)问题描述: 定义一个PriorDate函数,PriorDate函数为了获得当前输入日期的前一个日期, 执行如下操作:如果输入日期day变量值大于1,则把day变量的值减1;如果输入日期是212月份中某月的第一天,则把day变量的值置为前一个月的最后一天,month变量的值减1;如果输入日期是1月的第一天,则day变量的值置为31,month变量的值置为12

5、,year变量的值减1。关于最后一天的判断:如果是有31天的月份(1,3,5,7,8,10,12),day变量值为31;如果是有30天的月份(4,6,9,11),day变量值为30;如果是有29天的月份(闰年的2月),day变量值为29;如果是有28天的月份(非闰年的2月),day变量值为28。程序代码(开发环境:Windows7、VC+):#include using namespace std; int main() int lastday,lastmonth,lastyear; int day,month,year; bool c1=1,c2=1,c3=1; while(c1&c2&c3

6、) coutEnter todays date in form YYYY MM DDendl; cout例如2012年6月7号,输入形式为:2012 6 7yearmonthday; c1=(day=1)&(day=1)&(month=1900)&(year=2050); if (!c1) coutValue of day not in the range 131n; if (!c2) coutValue of month not in the range 112n; if (!c3) coutValue of year not in the range 190020501) lastday=

7、day-1; lastmonth=month; lastyear=year; else lastday=30; lastmonth=month-1; lastyear=year; break; case 2: case 4: case 6: case 8: case 9: case 11: if(day1) lastday=day-1; lastmonth=month; lastyear=year; else lastday=31; lastmonth=month-1; lastyear=year; break; case 3: if(day1) lastday=day-1; lastmont

8、h=month; lastyear=year; else if(year%4=0&year%100!=0|year%400=0) lastday=29; lastmonth=2; lastyear=year; else lastday=28; lastmonth=2; lastyear=year; break; case 1: if(day1) lastday=day-1; lastmonth=month; lastyear=year; else lastday=31; lastmonth=12; if(year!=1900) lastyear=year-1; else coutlastyea

9、r is not in rangeendl; break; default: couterror!endl; if(c1&c2&c3) coutthe lastday is:lastyear lastmonth lastdayn1day1day1day1语句语句5,7,10,122,4,6,8,9,11语句语句语句润年语句语句语句year!=1812语句语句语句c1&c2&c3打印结束31DIRYZ1. 语句覆盖 语句覆盖就是设计若干个测试用例,运行被测程序,使得每一可执行语句至少执行一次。n 测试用例的设计格式如下:n 【输入的(a, b, x),输出的(a, b, x)】测试数据执行路径预

10、期结果实际结果month=13,day=32,year=2013 OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=12,day=12,year=2010OBDF

11、HLYthe lastday is12 11 2010the lastday is12 11 2010month=12,day=1,year=2010OBDFHMYthe lastday is11 30 2010the lastday is11 30 2010month=11,day=12,year=2010 OBDFINYthe lastday is11 11 2010the lastday is11 11 2010month=11,day=1,year=2010 OBDFIPYthe lastday is10 31 2010the lastday is10 31 2010month=3,d

12、ay=12,year=2000 OBDFJQYthe lastday is3 11 2000the lastday is3 11 2000month=3,day=1,year=2010 OBDFJRYthe lastday is2 28 2010the lastday is2 28 2010month=1,day=12,year=2010 OBDFKSYthe lastday is1 11 2010the lastday is1 11 2010month=1,day=1,year=2010 OBDFKTWYthe lastday is12 31 2009the lastday is12 31

13、2009month=1,day=1,year=1812OBDFKTXYlastyear is not in rangethe lastday is12 31 lastyear is not in rangethe lastday is12 31 -2. 分支覆盖 执行足够的测试用例,使得程序中的每一个分支至少都通过一次 测试数据执行路径预期结果实际结果month=13,day=32,year=2013 OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in

14、the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=12,day=12,year=2010OBDFHLYthe lastday is12 11 2010the lastday is12 11 2010month=12,day=1,year=2010OBDFHMYthe lastday is11 30 2010the lastday is11 30 2010

15、month=11,day=12,year=2010 OBDFINYthe lastday is11 11 2010the lastday is11 11 2010month=11,day=1,year=2010 OBDFIPYthe lastday is10 31 2010the lastday is10 31 2010month=3,day=12,year=2000 OBDFJQYthe lastday is3 11 2000the lastday is3 11 2000month=3,day=1,year=2000 OBDFJRYthe lastday is2 29 2000the las

16、tday is2 29 2000month=3,day=1,year=2010 OBDFJRYthe lastday is2 28 2010the lastday is2 28 2010month=1,day=12,year=2010 OBDFKSYthe lastday is1 11 2010the lastday is1 11 2010month=1,day=1,year=2010 OBDFKTWYthe lastday is12 31 2009the lastday is12 31 2009month=1,day=1,year=1812OBDFKTXYlastyear is not in

17、 rangethe lastday is12 31 lastyear is not in rangethe lastday is12 31 -3. 条件覆盖 执行足够的测试用例,使得判定中的每个条件获得各种可能的结果。 测试数据执行路径预期结果实际结果month=13,day=32,year=2013 OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the ra

18、nge 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=0,day=0,year=1800OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range

19、 1.12Value of year not in the range 1812.2012error!month=12,day=12,year=2010OBDFHLYthe lastday is12 11 2010the lastday is12 11 2010month=12,day=1,year=2010OBDFHMYthe lastday is11 30 2010the lastday is11 30 2010month=11,day=12,year=2010 OBDFINYthe lastday is11 11 2010the lastday is11 11 2010month=11,

20、day=1,year=2010 OBDFIPYthe lastday is10 31 2010the lastday is10 31 2010month=3,day=12,year=2000 OBDFJQYthe lastday is3 11 2000the lastday is3 11 2000month=3,day=1,year=2000 OBDFJRYthe lastday is2 29 2000the lastday is2 29 2000month=3,day=1,year=2010 OBDFJRYthe lastday is2 28 2010the lastday is2 28 2

21、010month=1,day=12,year=2010 OBDFKSYthe lastday is1 11 2010the lastday is1 11 2010month=1,day=1,year=2010 OBDFKTWYthe lastday is12 31 2009the lastday is12 31 2009month=1,day=1,year=1812OBDFKTXYlastyear is not in rangethe lastday is12 31 lastyear is not in rangethe lastday is12 31 -4. 分支/条件覆盖 执行足够的测试用

22、例,使得分支中每个条件取到各种可能的值,并使每个分支取到各种可能的结果。测试数据执行路径预期结果实际结果month=13,day=32,year=2013 OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range

23、 1812.2012error!month=0,day=0,year=1800OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=12,day=12,year=20

24、10OBDFHLYthe lastday is12 11 2010the lastday is12 11 2010month=12,day=1,year=2010OBDFHMYthe lastday is11 30 2010the lastday is11 30 2010month=11,day=12,year=2010 OBDFINYthe lastday is11 11 2010the lastday is11 11 2010month=11,day=1,year=2010 OBDFIPYthe lastday is10 31 2010the lastday is10 31 2010mon

25、th=3,day=12,year=2000 OBDFJQYthe lastday is3 11 2000the lastday is3 11 2000month=3,day=1,year=2004OBDFJRUYthe lastday is2 29 2004the lastday is2 29 2004month=3,day=1,year=2000OBDFJRUYthe lastday is2 29 2000the lastday is2 29 2000month=3,day=1,year=2010 OBDFJRYthe lastday is2 28 2010the lastday is2 2

26、8 2010month=1,day=12,year=2010 OBDFKSYthe lastday is1 11 2010the lastday is1 11 2010month=1,day=1,year=2010 OBDFKTWYthe lastday is12 31 2009the lastday is12 31 2009month=1,day=1,year=1812OBDFKTXYlastyear is not in rangethe lastday is12 31 lastyear is not in rangethe lastday is12 31 -5. 条件组合覆盖执行足够的例子

27、,使得每个判定中条件的各种可能组合都至少出现一次。测试数据执行路径预期结果实际结果month=13,day=32,year=2013 OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012e

28、rror!month=0,day=0,year=1800 OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=0,day=1,year=1800OBCEGZValu

29、e of month not in the range 1.12Value of year not in the range 1812.2012error!Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=0,day=0,year=2000OACFGZValue of day not in the range 1.31Value of month not in the range 1.12error!Value of day not in the range 1.31V

30、alue of month not in the range 1.12error!month=0,day=1,year=2000OBCFGZValue of month not in the range 1.12error!Value of month not in the range 1.12error!month=1,day=0,year=1800OADFKTXZValue of day not in the range 1.31Value of year not in the range 1812.2012Value of day not in the range 1.31Value o

31、f year not in the range 1812.2012month=1,day=1,year=1800OBDEKTXZValue of year not in the range 1812.2012Value of year not in the range 1812.2012month=1,day=0,year=2000OADFKTXZValue of day not in the range 1.31Value of day not in the range 1.31month=1,day=1,year=2000OBDFKTXYthe lastday is12 31 1999th

32、e lastday is12 31 1999month=12,day=12,year=2010OBDFHLYthe lastday is12 11 2010the lastday is12 11 2010month=12,day=1,year=2010OBDFHMYthe lastday is11 30 2010the lastday is11 30 2010month=11,day=12,year=2010 OBDFINYthe lastday is11 11 2010the lastday is11 11 2010month=11,day=1,year=2010 OBDFIPYthe la

33、stday is10 31 2010the lastday is10 31 2010month=3,day=12,year=2000 OBDFJQYthe lastday is3 11 2000the lastday is3 11 2000month=3,day=1,year=2004OBDFJRUYthe lastday is2 29 2004the lastday is2 29 2004month=3,day=1,year=2000OBDFJRUYthe lastday is2 29 2000the lastday is2 29 2000month=3,day=1,year=2008OBD

34、FJRUYthe lastday is2 29 2008the lastday is2 29 2008month=3,day=1,year=2001OBDFJRUYthe lastday is2 28 2001the lastday is2 28 2001month=3,day=1,year=2010 OBDFJRYthe lastday is2 28 2010the lastday is2 28 2010month=1,day=12,year=2010 OBDFKSYthe lastday is1 11 2010the lastday is1 11 2010month=1,day=1,yea

35、r=2010 OBDFKTWYthe lastday is12 31 2009the lastday is12 31 2009month=1,day=1,year=1812OBDFKTXYlastyear is not in rangethe lastday is12 31 lastyear is not in rangethe lastday is12 31 -6. 基本路径测试方法 设计足够的测试用例,覆盖程序中所有可能的路径,其中控制流图如下图:1234567981011141513121617182119202229252662324272830303031 测试数据执行路径预期结果实

36、际结果month=13,day=32,year=2013 OACEGZValue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=0,day=0,year=1800 OACEGZVal

37、ue of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!Value of day not in the range 1.31Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=0,day=1,year=1800OBCEGZValue of month not in the range 1.12Value

38、of year not in the range 1812.2012error!Value of month not in the range 1.12Value of year not in the range 1812.2012error!month=0,day=0,year=2000OACFGZValue of day not in the range 1.31Value of month not in the range 1.12error!Value of day not in the range 1.31Value of month not in the range 1.12err

39、or!month=0,day=1,year=2000OBCFGZValue of month not in the range 1.12error!Value of month not in the range 1.12error!month=1,day=0,year=1800OADFKTXZValue of day not in the range 1.31Value of year not in the range 1812.2012Value of day not in the range 1.31Value of year not in the range 1812.2012month=1,day=1,year=1800OBDEKTXZValue of year n

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论