實(shí)驗(yàn)四(白盒測(cè)試)(共15頁(yè))_第1頁(yè)
實(shí)驗(yàn)四(白盒測(cè)試)(共15頁(yè))_第2頁(yè)
實(shí)驗(yàn)四(白盒測(cè)試)(共15頁(yè))_第3頁(yè)
實(shí)驗(yàn)四(白盒測(cè)試)(共15頁(yè))_第4頁(yè)
實(shí)驗(yàn)四(白盒測(cè)試)(共15頁(yè))_第5頁(yè)
已閱讀5頁(yè),還剩11頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、軟件測(cè)試計(jì)劃測(cè)試目的1. 練習(xí)和掌握軟件測(cè)試管理的一般過(guò)程與步驟;2. 掌握測(cè)試管理的人工過(guò)程和能夠通過(guò)相關(guān)管理軟件實(shí)現(xiàn)以下工作:a) 配置軟件資產(chǎn)信息、軟件需求、軟件模型和缺陷數(shù)據(jù)庫(kù);b) 創(chuàng)建和管理多個(gè)測(cè)試組和用戶(hù);c) 配置測(cè)試環(huán)境、編寫(xiě)詳細(xì)測(cè)試計(jì)劃、安排測(cè)試進(jìn)度;d) 設(shè)計(jì)測(cè)試腳本、測(cè)試用例;e) 實(shí)施測(cè)試、執(zhí)行測(cè)試和評(píng)估測(cè)試。測(cè)試選題對(duì)PriorDate程序(計(jì)算當(dāng)前輸入日期的前一天)的測(cè)試。測(cè)試人員何:軟件測(cè)試計(jì)劃及相關(guān)資料的編寫(xiě)與收集。侯:對(duì)特定問(wèn)題編寫(xiě)程序代碼,并對(duì)其進(jìn)行黑盒測(cè)試。金:對(duì)特定問(wèn)題編寫(xiě)程序代碼,并對(duì)其進(jìn)行白盒測(cè)試。測(cè)試方法使用白盒測(cè)試技術(shù),測(cè)試內(nèi)容包括語(yǔ)句覆蓋測(cè)試

2、、分支覆蓋測(cè)試、條件覆蓋測(cè)試、分支/條件覆蓋測(cè)試、條件組合覆蓋測(cè)試及基本路徑測(cè)試。測(cè)試資料白盒測(cè)試 測(cè)試規(guī)劃基于產(chǎn)品的內(nèi)部結(jié)構(gòu)進(jìn)行測(cè)試,檢查內(nèi)部操作是否按規(guī)定執(zhí)行,軟件各個(gè)部分功能是否得到充分使用,則這種測(cè)試方法稱(chēng)為白盒測(cè)試(White-box Testing)方法。 白盒測(cè)試又稱(chēng)為結(jié)構(gòu)測(cè)試、邏輯驅(qū)動(dòng)測(cè)試或基于程序的測(cè)試,一般用來(lái)分析程序的內(nèi)部結(jié)構(gòu)。 白盒測(cè)試將被測(cè)程序看作一個(gè)打開(kāi)的盒子,測(cè)試者能夠看到被測(cè)源程序,可以分析被測(cè)程序的內(nèi)部結(jié)構(gòu),此時(shí)測(cè)試的焦點(diǎn)集中在根據(jù)其內(nèi)部結(jié)構(gòu)設(shè)計(jì)測(cè)試用例。 􀂄白盒測(cè)試要求是對(duì)某些程序的結(jié)構(gòu)特性做到一定程度的覆蓋,或者說(shuō)這種測(cè)試是“基于覆蓋率的

3、測(cè)試”。 􀂄通常的程序結(jié)構(gòu)覆蓋有: 語(yǔ)句覆蓋 判定覆蓋 條件覆蓋 判定/條件覆蓋 路徑覆蓋軟件測(cè)試過(guò)程單元測(cè)試:針對(duì)每個(gè)單元的測(cè)試, 以確保每個(gè)模塊能正常工作為目標(biāo)。集成測(cè)試:對(duì)已測(cè)試過(guò)的模塊進(jìn)行組裝,進(jìn)行集成測(cè)試。目的在于檢驗(yàn)與軟件設(shè)計(jì)相關(guān)的程 序結(jié)構(gòu)問(wèn)題。確認(rèn)(有效性)測(cè)試:是檢驗(yàn)所開(kāi)發(fā)的軟件能否滿(mǎn)足所有功能和性能需求的最后手段。系統(tǒng)測(cè)試:檢驗(yàn)軟件產(chǎn)品能否與系統(tǒng)的其他部分(比如,硬件、數(shù)據(jù)庫(kù)及操作人員)協(xié)調(diào) 工作。驗(yàn)收(用戶(hù))測(cè)試:檢驗(yàn)軟件產(chǎn)品質(zhì)量的最后一道工序。主要突出用戶(hù)的作用,同時(shí)軟件開(kāi) 發(fā)人員也應(yīng)有一定程度的參與。數(shù)據(jù)整理測(cè)試所得到的用例測(cè)試報(bào)告、BUG報(bào)告,需要

4、進(jìn)行反饋和最后的歸檔,歸檔的工作按照項(xiàng)目計(jì)劃中所規(guī)定的內(nèi)容進(jìn)行,反饋的工作在測(cè)試項(xiàng)結(jié)束后,整理成測(cè)試總結(jié)報(bào)告后進(jìn)行,具體的日期,在項(xiàng)目計(jì)劃中有規(guī)定。不同階段的測(cè)試,都需要重復(fù)以上的步驟。其他必要的數(shù)據(jù)整理的工作,由項(xiàng)目經(jīng)理在進(jìn)行過(guò)程中進(jìn)行安排。PriorDate程序測(cè)試報(bào)告(白盒)問(wèn)題描述: 定義一個(gè)PriorDate函數(shù),PriorDate函數(shù)為了獲得當(dāng)前輸入日期的前一個(gè)日期, 執(zhí)行如下操作:如果輸入日期day變量值大于1,則把day變量的值減1;如果輸入日期是212月份中某月的第一天,則把day變量的值置為前一個(gè)月的最后一天,month變量的值減1;如果輸入日期是1月的第一天,則day變量

5、的值置為31,month變量的值置為12,year變量的值減1。關(guān)于最后一天的判斷:􀂆如果是有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。程序代碼(開(kāi)發(fā)環(huán)境:Windows7、VC+):#include <iostream> using namespace std; int main() int lastda

6、y,lastmonth,lastyear; int day,month,year; bool c1=1,c2=1,c3=1; while(c1&&c2&&c3) cout<<"Enter today's date in form YYYY MM DD"<<endl; cout<<"例如2012年6月7號(hào),輸入形式為:2012 6 7"<<endl; cin>>year>>month>>day; c1=(day>=1)&

7、&(day<=31); c2=(month>=1)&&(month<=12); c3=(year>=1900)&&(year<=2050); if (!c1) cout<<"Value of day not in the range 131"<<"n" if (!c2) cout<<"Value of month not in the range 112"<<"n" if (!c3) cout<

8、;<"Value of year not in the range 19002050"<<"n" switch(month) case 5: case 7: case 10: case 12: if(day>1) lastday=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(day&

9、gt;1) lastday=day-1; lastmonth=month; lastyear=year; else lastday=31; lastmonth=month-1; lastyear=year; break; case 3: if(day>1) lastday=day-1; lastmonth=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; l

10、astyear=year; break; case 1: if(day>1) lastday=day-1; lastmonth=month; lastyear=year; else lastday=31; lastmonth=12; if(year!=1900) lastyear=year-1; else cout<<"lastyear is not in range"<<endl; break; default: cout<<"error!"<<endl; if(c1&&c2&

11、;&c3) cout<<"the lastday is:"<<lastyear<<" "<<lastmonth<<" "<<lastday<<"n"<<endl; return 0;測(cè)試方法:白盒測(cè)試(語(yǔ)句覆蓋、分支覆蓋、條件覆蓋、分支/條件覆蓋、條件組合覆蓋及基本路徑測(cè)試方法)測(cè)試用例設(shè)計(jì): 程序的流程圖如下圖:YUXWVTJPHGFECBAOYesYesNoYesYesYesYesYesNoNoNoNoNoN

12、oNodefaultSQLNMK開(kāi)始天數(shù)1到31月份1到12打印輸入天數(shù)出錯(cuò)打印輸入月份出錯(cuò)年份1812到2012Month匹配打印輸入年份出錯(cuò)day>1day>1day>1day>1語(yǔ)句語(yǔ)句5,7,10,122,4,6,8,9,11語(yǔ)句語(yǔ)句語(yǔ)句潤(rùn)年語(yǔ)句語(yǔ)句語(yǔ)句year!=1812語(yǔ)句語(yǔ)句語(yǔ)句c1&&c2&&c3打印結(jié)束31DIRYZ1. 語(yǔ)句覆蓋 語(yǔ)句覆蓋就是設(shè)計(jì)若干個(gè)測(cè)試用例,運(yùn)行被測(cè)程序,使得每一可執(zhí)行語(yǔ)句至少執(zhí)行一次。n 測(cè)試用例的設(shè)計(jì)格式如下:n 【輸入的(a, b, x),輸出的(a, b, x)】測(cè)試數(shù)據(jù)執(zhí)行路徑預(yù)期結(jié)果實(shí)際

13、結(jié)果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=2010OBDFHLYth

14、e 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,day=12

15、,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 2009m

16、onth=1,day=1,year=1812OBDFKTXYlastyear is not in rangethe lastday is12 31 lastyear is not in rangethe lastday is12 31 -8589934602. 分支覆蓋 執(zhí)行足夠的測(cè)試用例,使得程序中的每一個(gè)分支至少都通過(guò)一次 測(cè)試數(shù)據(jù)執(zhí)行路徑預(yù)期結(jié)果實(shí)際結(jié)果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

17、 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=2010OBDFHLYthe lastday is12 11 2010the lastday is12 11 2010month=12,day=1,year=2010OBDFHMYthe lastday is11 30 2010the lastday is11 30

18、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,day=12,year=2000 OBDFJQYthe lastday is3 11 2000the lastday is3 11 2000month=3,day=1,year=2000 OBDFJRYthe lastday is2 29 2000the

19、 lastday 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 no

20、t in rangethe lastday is12 31 lastyear is not in rangethe lastday is12 31 -8589934603. 條件覆蓋 執(zhí)行足夠的測(cè)試用例,使得判定中的每個(gè)條件獲得各種可能的結(jié)果。 測(cè)試數(shù)據(jù)執(zhí)行路徑預(yù)期結(jié)果實(shí)際結(jié)果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

21、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=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

22、 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 2010month=11,day=12,year=2010 OBDFINYthe lastday is11 11 2010the lastday is11 11

23、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 lastday is2 29 2000month=3,day=1,year=2010 OBDFJRYthe lastday is2 28 2010the las

24、tday 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 rangethe lastday is12 31 lastyear is not in rangethe lastday is12 31 -858993

25、4604. 分支/條件覆蓋 執(zhí)行足夠的測(cè)試用例,使得分支中每個(gè)條件取到各種可能的值,并使每個(gè)分支取到各種可能的結(jié)果。測(cè)試數(shù)據(jù)執(zhí)行路徑預(yù)期結(jié)果實(shí)際結(jié)果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

26、 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 1.12Value of year not in the range 1812.2012error!m

27、onth=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 lastday is10 31 2010the l

28、astday 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=2010 OBDFJRYthe lastday is2 28

29、 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 rangethe lastday is12 31 lastyear is not in rangethe lastday is1

30、2 31 -8589934605. 條件組合覆蓋執(zhí)行足夠的例子,使得每個(gè)判定中條件的各種可能組合都至少出現(xiàn)一次。測(cè)試數(shù)據(jù)執(zhí)行路徑預(yù)期結(jié)果實(shí)際結(jié)果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 y

31、ear not in the range 1812.2012error!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!mo

32、nth=0,day=1,year=1800OBCEGZValue 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!Valu

33、e of day not in the range 1.31Value 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 d

34、ay not in the range 1.31Value of 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=2000OBD

35、FKTXYthe lastday is12 31 1999the 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=1

36、1,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=2004OBDFJRUYthe lastday is2 29 2004the lastday is2 29 2004month=3,day=1,year=2000OBDFJRUYthe lastday is2 29 2000the lastday is2 29

37、 2000month=3,day=1,year=2008OBDFJRUYthe 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 lastd

38、ay 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 -8589934606. 基本路徑測(cè)試方法 設(shè)計(jì)足夠的測(cè)試用例,覆蓋程序中所有可能的路徑,其中控制流圖如下圖:12345679810111415131216171821192

39、02229252662324272830303031 測(cè)試數(shù)據(jù)執(zhí)行路徑預(yù)期結(jié)果實(shí)際結(jié)果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.201

40、2error!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=1800OBCEGZVa

41、lue 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.31Value 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.31

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論