軟件測(cè)試相關(guān)度量



《軟件測(cè)試相關(guān)度量》由會(huì)員分享,可在線閱讀,更多相關(guān)《軟件測(cè)試相關(guān)度量(66頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。
1、單擊此處編輯母版文本樣式,,第二級(jí),,第三級(jí),,第四級(jí),,第五級(jí),,*,*,,Software Metrics,Lecture 10,,Software Test Metrics,,清 華 大 學(xué) 軟 件 學(xué) 院,,,2004年5月11日,1,COCOMO,where,a,,,b,,,c,and,d,depend on the,development mode,.,Organic mode,,Semi-detached mode,,Embedded mode,Basic model,,,Intermediate model,,Advanced model,2,,COCOMO: Basic,Th
2、e Basic COCOMO,Mode,a,b,Organic,2.4,1.05,Semi-detached,3.0,1.12,Embedded,3.6,1.20,development time cannot be predicted at this stage.,3,,COCOMO: Intermediate,The Intermediate COCOMO:,Mode,c,d,Organic,2.5,0.38,Semi-detached,2.5,0.35,Embedded,2.5,0.32,Mode,a,b,Organic,3.2,1.05,Semi-detached,3.0,1.12,E
3、mbedded,2.8,1.20,4,,COCOMO II,Application Composition,,E = OP / PROD,,,Early Design model,,,E = 2.45 × KLOC × EAF,,Post-Architecture model,5,,Putnam’s SLIM,6,,Test Concepts,,Estimating Number of Test Case &,Allocating Test Times,,Test Coverage Metrics,,Remaining Defects Metrics,Contents,7,,Section 1
4、,,Test Concepts,8,,防不勝防的軟件錯(cuò)誤 ——,,,例1:1963年, 美國(guó), 飛往火星的火箭爆炸, 損失$ 10,million.,,原因:,FORTRAN,循環(huán),DO 5 I = 1, 3,,誤寫為,DO 5 I =,,1,.,3,,軟件測(cè)試是保證軟件質(zhì)量的關(guān)鍵步驟,是對(duì)軟件規(guī)格說明、設(shè)計(jì)和編碼的最后復(fù)審,其工件量約占總工作量,40%,以上(對(duì)于人命關(guān)天的情況,測(cè)試相當(dāng)于其它部分總成本的,3 — 5倍,),Roles of Software Testing,9,,What is software testing,,“ Testing is the process
5、of,,executing a program with the,,intent of finding errors.”,,,Glen Myers,,10,,Software Testing Objectives,Needing,minimum effort and time,,Showing that software functions,work according to specification,It cannot show absence of errors or defects. It can only show that errors are present,Uncovering
6、,different cases,of errors,11,,1:5-10,Mainframes,,i.e.,1 tester for every 5 to 10 developers,,2:3,,Microsoft, 1992,,2:1,,Lotus (for 1-2-3 Windows),,1:2,,Average of 4 major companies,1992 Microsoft, Borland, WordPerfect, Novell,Tester-to-developer ratios,12,,What is a test case?,A set of test,inpu
7、ts,, execution conditions, and,expected results,developed for a particular objective,13,,A test is made up of (many) test cases,,A test procedure is the detailed instructions for setting up, starting, monitoring and restarting a given test case. a,.,k.a,test plan,,a test case may be used in more tha
8、n one test procedure,,a test case may include many subtests,What is a test?,14,,Test,test case,test case,test case,subtest,subtest,subtest,subtest,What is a test?,(cont.),15,,Testing Methodology,White-box,SELECTED,INPUTS,RESULTANT,OUTPUTS,INTERNAL,BEHAVIOR,DESIRED,OUTPUT,SOFTWARE,DESIGN,Black-box,SE
9、LECTED,INPUTS,RESULTANT,OUTPUTS,DESIRED,OUTPUT,16,,Objective:,Cover,the software structure,Structural (White-Box) Test Criteria,Criteria based on,,control flow,,data flow,,Metric: percentage of coverage achieved,,Adequacy based on metric requirements for criteria,17,,Graph representation of control
10、flow and,,data flow relationships,Flow Graphs,Control Flow,,The partial order of statement execution, as defined by the semantics of the language,,Data Flow,,The flow of values from definitions of a variable to its uses,18,,Statement Coverage,,Branch Coverage,,Condition Coverage,,Basis Path Coverage
11、,,All-Edges Coverage,,All-Paths Coverage,White-Box Test,19,,1,,2,,3,,4,,5,,6,,7,,8,,9,,10,,11,,12,,13,,14,,15,function,P,return,INTEGER,is,,begin,,X, Y: INTEGER;,,READ(X); READ(Y);,,while,(X > 10),loop,,X := X – 10;,,exit when,X = 10;,,end loop,;,,if,(Y < 20,and then,X,mod,2 = 0),then,,Y := Y +
12、20;,,else,,Y := Y – 20;,,end if,;,,return,2*X + Y;,,end,P;,A Sample Program to Test,20,,2,3,4,5,6,9′,10,12,14,T,T,F,F,9,,T,F,7,T,F,9,a,9,b,P’s Control Flow Graph (CFG),21,,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,F,At least 2 test cases needed,(X = 20, Y = 10),,,,,(X = 20, Y = 30),,,,All-Statements Coverag
13、e of P,22,,minimum level coverage using structural testing,,may be impossible to achieve 100% statement coverage,,code only executed in exceptional or dangerous circumstances,,code that is unreachable,Statement Testing: weaknesses,23,,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,F,At least 2 test cases needed,(
14、X = 20, Y = 10),,,,,(X = 15, Y = 30),,,All-Branches Coverage of P,24,,Branch Testing,:,weaknesses,Branch testing is one level up from statement testing in degree of coverage,,same problem in achieving 100% coverage,25,,2,3,4,5,6,9,b,10,12,14,T,T,F,F,9,a,T,F,7,T,F,At least 3 test cases needed,,(X = 2
15、0, Y = 20),,,5T,7T,9a,F,,9bT,,(X = 15, Y = 10),,,5T,7,F,,9aT,9b,F,,(X = 9, Y = 10),,,5,F,,7,F,,9aT,9b,F,Condition Coverage of P,X > 10,,X = 10,,Y < 20,,X mod 2=0,26,,Condition Coverage,Generate test data such that all conditions in a decision take on both outcomes (if possible) at least once,,May n
16、ot achieve branch coverage:,,consider,while (x 20 ),,x = 0,causes first true, second false,,x = 34,causes first false, second true,27,,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,F,Basic-paths Coverage of P,cyclomatic complexity:,V(G) = e - n + 2,28,,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,F,4 test cases needed,(X =
17、 10, Y = 10),,,(X = 10, Y = 20),,(X = 20, Y = 10),,(X = 15, Y = 10),,Basic-paths Coverage of P,,,,,,,,29,,Basis path testing,:,Strengths/weaknesses,Basis set is easy to compute,,the technique is readily applicable to both structured and unstructured programs,,Drawback,: the basis set is not unique;
18、there will be obvious paths omitted,,Drawback,: the number of paths in the basis set can greatly exceed the number necessary to achieve branch coverage,30,,2,3,4,5,6,9,b,10,12,14,T,T,F,F,9,a,T,F,7,T,F,At least 3 test cases needed,(X = 20, Y = 10),,,,(X = 5, Y = 30),,,,(X = 21, Y = 10),,,All-Edges Co
19、verage of P,31,,2,3,4,5,6,9b,10,12,14,T,T,F,F,9a,T,F,7,T,F,Infinitely many test cases needed,(X = 5, Y = 10),,(X = 15, Y = 10),,(X = 25, Y = 10),,…,All-Paths Coverage of P,32,,All-Paths testing,Generate test data to exercise all distinct paths in a program!,,a path that makes,i,iterations through a
20、loop is distinct from a path that makes,i+1,iterations through the loop, even if the same nodes are visited in both iterations.,,Thus, there are an,infinite number,of paths in the string processing program!,33,,All-Paths testing,(cont.),包含的不同執(zhí)行路徑數(shù)達(dá),5,20,條,對(duì)每一條路徑進(jìn)行測(cè)試需要1毫秒,假定一年工作,365,×,24,小時(shí),要想把所有路徑測(cè)試
21、完,需3170年,34,,2,3,4,5,6,9,b,10,12,14,T,F,9,a,T,F,Y,X,X,Y,Y,X,X,Y,Y,X,X,X,T,F,7,T,F,X,X,P’s Control and Data Flow Graph,35,,How many test cases are needed?,2,3,4,5,6,9,b,10,12,14,T,F,9,a,T,F,Y,X,X,Y,Y,X,X,Y,Y,X,X,X,T,F,7,T,F,X,X,All-Uses Coverage of P,36,,all-statements,all-edges,boundary-interior,,lo
22、op testing,min-max,,loop testing,all-paths,all-,defs,all-uses,all-DU-paths,all-p-uses,all-c-uses,C1,C2,subsumes,Structural,Subsumption,Hierarchy,all-branches,37,,Black Box Test,Equivalence Class,,Boundary Analysis,,…,38,,Testing Levels,Testing occurs throughout lifecycle,,Unit,,Integration,,System,,
23、Acceptance,,Regression,39,,Overall Approach,Unit testing (module),,,Integration testing,,,System testing,,,Acceptance testing,White / Black box,,,Black box,,,Black box - requirements,,Black box - performance,40,,Section 2,,,Estimating Number of Test Case & Allocating Test Times,,41,,Estimate No. of
24、 Test Cases,,Time,,(available time,?,available staff)/,,(average time to prepare a test case),,How many test cases do we need?,,Cost,,,(available budget) /,,(average preparation cost per test case),,Select the minimum number of the two,42,,Example,Development budget:,$4 million,,,%10,of which spent
25、on preparing test cases,,Each test case costs,$250,or,4 hours,,The duration of project is set to be,25 weeks,(of 40 hours each) and,5 staffs,for test cases,,How many test cases should be prepared?,,,From cost,N1 = (4,000,000,?,0.1) / 250 = 1,600,,,From time,N2 = (25,?,40,?,5) / 4 = 1,250,,,,,,,,N =
26、min (N1 , N2),, therefore,,N = 1,250,43,,Allocating Test Time,How to allocate test time among,,system components,(e.g., acquired components, developed components),,test type,(e.g., unit test, integrated test, system test) and,44,,Test Time: Systems /1,Allocate less than 10% of the remaining time to
27、 certification test of acquired components,,Allocate time to the developed components based on their significance,OS, System software,Developed,,components,Acquired,,components,Interface to other systems,45,,Test Time: Systems /2,Example:,,Total test time: 340 h,,,,,,,,Test case proportion:,,Associ
28、ated system components: 64.7%,,Operating system component: 23.5%,Interface to other systems,,(40 h),Acquired,,components,,(20 h),Developed,,components,,(200 h),OS, System software,,(80 h),Associated,,System,,Components,,220 h,46,,Test Case Invocation,In what order the system should be tested?,,Recom
29、mended sequence of system test:,,Acquired components (certification test only),,Developed product,,Other systems, OS, etc. (load test only),47,,Section 3,,Test Coverage Metrics,48,,Test Coverage Metrics /1,Coverage of what?,,Statement coverage,,Branch coverage,,Component/Module coverage,,Specifica
30、tion coverage,,GUI coverage,,…,49,,Test Coverage /1,Statement coverage (,CV,s,),,Portion of the statements tested by at least one test case.,50,,Test Coverage /2,Branch coverage (,CV,b,),,Portion of the branches in the program tested by at least one test case.,,51,,Test Coverage /3,Component c
31、overage (,CV,cm,),,Portion of the components in the software covered and tested by at least one test case,52,,Test Coverage /4,GUI coverage (,CV,GUI,),,Portion of the GUI elements (e.g., menus, buttons, multiple selections, text fields, etc.) in the software covered and tested by at least one test
32、 case.,53,,Test Pass, Failure & Pending Rate/1,Test Pass Rate (,R,tp,),,Portion of the test cases that were executed successfully (i.e., produced expected output).,54,,Test Pass, Failure & Pending Rate/2,Test Failure Rate (,R,tf,),,Portion of the test cases that were not executed successfully (i.e.,
33、 produced different output than expected).,55,,Test Pass, Failure & Pending Rate/3,Test Pending Rate (,R,tpend,),,Portion of the test cases that were pending (i.e.,,couldn,’t be executed or correctness of the output,couldn,’t be verified).,56,,Section 4,,Remaining Defects Metrics,57,,Remaining Defec
34、ts Metrics /1,The idea is to inject (seed) some faults in the program and calculate the remaining bugs based on detecting the seeded faults [Mills 1972],Assuming that the probability of detecting the seeded and non-seeded faults are the same,58,,Seeded,,Detected,Seeded,,Undetected,Remaining,,Detect
35、ed,Remaining,,Undetected,Total,,,Seeded,Total Remaining,Remaining Defects Metrics /2,59,,Remaining Defects Metrics /3,N,s,is already known;,,n,d,,and,n,s,are measured for a certain period of time,60,,Example,Assume that,61,,Comparative Remaining Defects/1,Two testing teams will be assigned to test the same product,62,,Example,63,,Summary,Estimating Number of Test Case?,Test Coverage Metrics,,Remaining Defects Metrics,64,,Further reading,,1. Software testing,Homework,65,,Thanks for your time and attention!,66,,
- 溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 踏春尋趣 樂享時(shí)光——春季旅游踏春出游活動(dòng)
- 清明假期至安全不缺席風(fēng)起正清明安全需守護(hù)
- 全國(guó)黨員教育培訓(xùn)工作規(guī)劃
- XX中小學(xué)公共衛(wèi)生培訓(xùn)樹立文明衛(wèi)生意識(shí)養(yǎng)成良好衛(wèi)生習(xí)慣
- 小學(xué)生常見傳染病預(yù)防知識(shí)培訓(xùn)傳染病的預(yù)防措施
- 3月18日全國(guó)愛肝日中西醫(yī)結(jié)合逆轉(zhuǎn)肝硬化
- 肝病健康宣教守護(hù)您的肝臟健康如何預(yù)防肝炎
- 垃圾分類小課堂教育綠色小衛(wèi)士分類大行動(dòng)
- 中小學(xué)班主任經(jīng)驗(yàn)交流從勝任到優(yōu)秀身為世范為人師表 立責(zé)于心履責(zé)于行
- 教師數(shù)字化轉(zhuǎn)型理解與感悟教師數(shù)字化轉(zhuǎn)型的策略與建議
- 團(tuán)建小游戲團(tuán)建破冰小游戲團(tuán)隊(duì)協(xié)作破冰游戲多人互動(dòng)
- 教師使用deepseek使用攻略讓備課效能提升
- 辦公室會(huì)議紀(jì)要培訓(xùn)會(huì)議內(nèi)容會(huì)議整理公文攥寫
- 黨員要注重培塑忠誠(chéng)奮斗奉獻(xiàn)的人格力量
- 橙色卡通風(fēng)兒童春季趣味運(yùn)動(dòng)會(huì)