软件测试实验报告二.docx

上传人:太** 文档编号:97950485 上传时间:2024-07-08 格式:DOCX 页数:12 大小:31.44KB
返回 下载 相关 举报
软件测试实验报告二.docx_第1页
第1页 / 共12页
软件测试实验报告二.docx_第2页
第2页 / 共12页
点击查看更多>>
资源描述

《软件测试实验报告二.docx》由会员分享,可在线阅读,更多相关《软件测试实验报告二.docx(12页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、南昌航空大学实验报告2012年12月14日课程名称:软件测试与质量保证实验名称:功能性测试班级:姓名:同组人:指导教师评定:签名:一、实验目的掌握边界值、等价类和决策表测试的基本方法二、实验内容1、设计三角形问题的边界值测试用例2、对于nextdate函数设计决策表测试用例程序3、对于佣金问题设计出等价类测试用例三、概要设计1、设计三角形问题的边界值测试用例设计等价类Ri=a,b,c:有三条边a,b和c的等边三角形R2=a,b,c:有三条边a,b和c的等腰三角形R3=a,b,c:有三条边a,b和c的不等边三角形R4=a,b,c:三条边a,b和c不构成三角形2、对于nextdate函数设计决策表

2、测试用例程序设计如下的等价类:M1=月份:每月有30天M3=月份:此月是12月M2=月份:每月有31天,12月除外M4=月份:此月是2月D1=日期:1W日期W27D2=日期:日期=28D3=日期:日期=29D5=日期:日期=30D4=日期:日期=30丫1=年:年是闰年丫2=年:年不是闰年3、对于佣金问题设计出等价类测试用例设计如下等价类:L1=枪机:1W枪机W70|_2=枪机=-1S1=枪托:1W枪托W80B1=枪管:1W枪管W90输入变量对应的无效类是:L3=枪机:枪机=0或枪机v-1L3=枪机:枪机70S2=枪托:枪托1S3=枪托:枪托80B2=枪管:枪管v1B2=枪管:枪管90四、详细设

3、计1、设计三角形问题的边界值测试用例边界值分析测试用例:用例abc预期输出11001001等腰三角形21001002等腰三角形3100100100等边三角形4100100199等腰三角形5100100200非三角形61001100等腰三角形71002100等腰三角形8100100100等边三角形9100199100等腰三角形10100200100非三角形111100100等腰三角形122100100等腰三角形13100100100等边三角形14199100100等腰三角形15200100100非三角形2、对于nextdate函数设计决策表测试用例程序设计如下的决策表测试用例:月例工D刀俗日期年

4、预期输出1 341520012001 年416 日44302001200 1年5月1曰54312001不可髓691152001200 1年1月16日1 O13120012001 2 月 1 口1 1 1 41 21520012001 年1 2 月 1 6 口1 51 23120012002年1日1日1621520012001年2月16日1722820042004年2 月 29 日1822820012001年3月1日1922920042004年3 J3 1 日202292001不可也21 , 222302001为、口J育旨3、对于佣金问题设计出等价类测试用例设计如下等价类测试用例用例ID枪机枪托

5、枪管预期输出SRI-14045枪机值不在有效值域1.70中SR235-145枪托值不在有效值域1.80中SR33540-1枪管值不在有效值域1.90中SR4-1-145枪机值不在有效值域1.70中枪托值不在有效值域L.80中SR5-140-1枪机值不在有效值域1.70中枪管值不在有效值域1.90中SR635-1-1枪托值不在有效值域1.80中枪管值不在有效值域1.90中SR7-1-1-1枪机值不在有效值域1.70中枪托值不在有效值域L.80中枪管值不在有效值域1.90中五、程序调试1、设计三角形问题的边界值测试用例 实验结果如下:The experiment result is.Isoscel

6、es triangele?Isosceles triangele?Equailateral triangle?Isosceles triangele?Not a triangle?Isosceles triangele?Isosceles triangele?Equailateral triangle?Isosceles triangele?Not a triangle?Isosceles triangele?Isosceles triangele?Equailateral triangle?Isosceles triangele?Not a triangle?After compared w

7、ith the expected results15 is right,0 is wrong2、对于nextdate函数设计决策表测试用例程序 实验结果如下:Please input todayJ s 4 15 2001 Tomorrow date is 4 Please input todays 4 31 2001The date is wrong? Please input todays 4 31 2001 the date is wrong? Please input todays 1 15 2001TomorrowJ s date is 1 Please input todays 1

8、31 2001Tomorrow,s date is 2 Please input today, s 12 15 2001date is from16 2001date is fromdate is fromdate is from16 2001date is from1 2001date is fromMMMMMMMMMMMMDD VVVV.DD VVVV.DD VVVV.DD VVVV.DD VVVV.DD VVVV.Tomorrows date is 12 16 2001Please input todaydate is from MM DD VVVV.12 31 2001Tomorrow

9、 , s date is 1 Please input today,s 2 15 2001Tomorrow,s date is 2 Please input todays 2 28 2004Tomorrows date is 2 Please input todays 2 28 2001Tomorrowdate is 3 Please input todays 2 29 2004Tomorrows date is 3 Please input today s 2 29 2001The date is wrong?Please input todays 2 30 2001The date is

10、wrong?1 2002 date is16 2001date is29 2004date is1 2001 date is1 2004 date isdate isfromfromfromfromfromfromMMDDVVVV.MMDDVVVV.MMDDVVVV.MMDDVVVV.MMDDMMDDVVVV.3、对于佣金问题设计出等价类测试用例 实验结果如下:Please input locksJ number.-1Locks sold:0Stocks sold:0Barrels sold:0The sales:0.000000Commission is $0.000000Please in

11、put locks number.35Please input stocksJ and barrelsJ number.-145Please input the locks number.-1Locks sold:35Stocks sold:-lBarrels sold:45The sales:2670.000000Commission is $394.000000Please input locksJ number.Please input stocksJ and barrels9 number. .Please input the locksJ number.Locks sold:35St

12、ocks sold40Barrels sold:-lThe sales:2750.000000Commission is $410,000000Please input locks * number.Locks sold:0Stocks sold:0Barrels sold:0The sales:0.000000Commission is $0.000000六、实验总结通过这次实验,让我掌握边界值、等价类和决策表测试的基本方法。七、附录TRIANGLE. C#include void main ()int flag15 = 3,3, 2,3, 5,3, 3,2, 3,5, 3,3, 2, 3,

13、 5,a15 = 100, 100,100,100,100,100,100,100, 100,100,1, 2, 100,199, 200,b15 = 100, 100,100,100,100,1, 2,100,199, 200,100,100, 100,100, 100,c15 = l, 2, 100,199,200,100,100,100,100, 100,100,100, 100,100, 100;int i,j=0;printf The experiment resultis.n);for(i=0;i15;i+) if(isTriangle(ai, bi, ci)=flagi)j+;p

14、rintf (resultsn);After compared with the expectedprintf (,z%d is right, %d is wrongn,z, j, 15j);int isTriangle(int a,int b,int c)(int flag;if(ab+c & ba+c & ca+b)flag=l;elseflag=0;if (flag=l)(if(a=b & b=c)flag=2;printf (z,Equailateral triangle!nz,);else if (a!=b & b!=c & a!=c) flag=4;printf (z,Scalen

15、e triangle!n,z);else flag=3;printf (Isosceles triangele! n,z);else flag=5;printf (/zNot a triangle!n,);)return flag;)DATE. C#includevoid main()(int tomorrowDay, tomorrowMonth, tomorrowYear, day, month, year; 设置 程序需要的变量printf (Please input todays date is from MM DD YYYY. n); scanf(%d %d %d,femonth, &

16、day, feyear);switch (month) 通过switch来选择不同的月份下的情况case 1:case 3:case 5:case 7:case 8:case 10:上面的月份都是31天的,下面代码实现31天情况下的月份if(day31) tomorrowDay=day+l;t omorrowMon t h=mon t h;tomorrowY ear=year;else(tomorrowDay=l;tomorrowMonth=month+l;tomorrowY ear=year;break;case 4:case 6:case 9:case 11:上面的月份都是30天的,下面代

17、码实现30天情况下的月份 if(day30)(tomorrowDay=day+l;tomorrowMonth=month;tomorrowYear=year;)elsetomorrowDay=l;tomorrowMonth=month+l;tomorrowYear=year;break;case 12:/由于12月一过,年份要加一,故单独把12月拿出if (day31)(tomorrowDay=day+l;tomorrowMonth=month;tomorrowY ear=year;else(tomorrowDay=l;tomorrowMonth=l;if(year=2012) printf

18、(,zThe 2012 is over!n/z);exit (0);elsetomorrowYear=year+l;break;case 2:根据是否闰年来判断二月的天数,故把二月单独拿出来 if(day28)(tomorrowDay=day+l;tomorrowMonth=month+l;tomorrowYear=year+l;)else if (day=28)(if (year/4=0 & year/100!=0) | | year/400=0) tomorrowDay=29;tomorrowMonth=month;tomorrowYear=year;else(tomorrowDay=l;

19、tomorrowMonth=3;tomorrowYear=year;else if (day=29) (tomorrowDay=l;tomorrowMonth=3; tomorrowYear=year;)else printf (,zFeb can not have %d dayn,day);)printf(Tomorrowsdateis %d %d %dn,tomorrowMonth, tomorrowDay, tomorrowYear);)COMMISSI. C#include void main () (int locks,stocks, barrels;float lockPrice,

20、stockPrice, barrelPrice;int totalLocks, totalStocks, totalBarrels;float lockSales,stockSales, barrelSales; float sales, commission;lockPrice=45. 0;stockPrice=30. 0;barrelPrice=25. 0;totalLocks=0;totalStocks=0;totalBarrels=0;printf (Please input locks, number. n/z); scanf (%d, &locks);while(locks!=-1

21、)(printf CPlease input stocks and barrels number. . n/z); scanf (z,%d %d,z, festocks, febarrels);totalLocks=totalLocks+locks; totalStocks=totalStocks+stocks; totalBarrels=totalBarrels+barrels;printf (,zPlease input the locks, number. nz,); scanf(%d, felocks);printf (Locks sold:%dnz,, totalLocks);pri

22、ntf (,zStocks sold:%dn,totalStocks);printf (,zBarrels sold:%dn,totalBarrels);lockSales=lockPrice*totalLocks;stockSales=stockPrice*totalStocks;barrelSales=barrelPrice5ictotalBarrels;sales=lockSales+stockSales+barrelSales; printf (z,The sales:%fnz,, sales);if (sales1800. 0)(commission. 10*1000. 0;commission=comniission+0. 15*800. 0;commission=commission+0. 20*(sales-1800. 0);)else if (sales1000. 0)(commission. 10*1000. 0;commission=commission+0 15*(sales-1000. 0);)elseconunission=0. 10*sales;printf (Commission is commission);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 解决方案

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁