




已閱讀5頁,還剩61頁未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1,Software Metrics,Lecture 10 Software Test Metrics,清 華 大 學(xué) 軟 件 學(xué) 院 2004年5月11日,2,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,3,COCOMO: Basic,The Basic COCOMO,development time cannot be predicted at this stage.,4,COCOMO: Intermediate,The Intermediate COCOMO:,5,COCOMO II,Application Composition E = OP / PROD Early Design model E = 2.45 KLOC EAF Post-Architecture model,6,Putnams SLIM,7,Test Concepts Estimating Number of Test Case & Allocating Test Times Test Coverage Metrics Remaining Defects Metrics,Contents,8,Section 1 Test Concepts,9,防不勝防的軟件錯(cuò)誤 例1:1963年, 美國, 飛往火星的火箭爆炸, 損失$ 10 million. 原因: FORTRAN循環(huán) DO 5 I = 1, 3 誤寫為 DO 5 I = 1.3,軟件測試是保證軟件質(zhì)量的關(guān)鍵步驟,是對軟件規(guī)格說明、設(shè)計(jì)和編碼的最后復(fù)審,其工件量約占總工作量40%以上(對于人命關(guān)天的情況,測試相當(dāng)于其它部分總成本的3 5倍),Roles of Software Testing,10,What is software testing,“ Testing is the process of executing a program with the intent of finding errors.” Glen Myers,11,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 different cases of errors,12,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,13,What is a test case?,A set of test inputs, execution conditions, and expected results developed for a particular objective,14,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 than one test procedure a test case may include many subtests,What is a test?,15,Test,test case,test case,test case,subtest,subtest,subtest,subtest,What is a test? (cont.),16,Testing Methodology,White-box,Black-box,17,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,18,Graph representation of control 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,19,Statement Coverage Branch Coverage Condition Coverage Basis Path Coverage All-Edges Coverage All-Paths Coverage,White-Box Test,20,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 + 20; else Y := Y 20; end if; return 2*X + Y; end P;,A Sample Program to Test,21,2,3,4,5,6,9,10,12,14,T,T,F,F,9,T,F,7,T,F,9a,9b,Ps Control Flow Graph (CFG),22,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 Coverage of P,23,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,24,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 = 15, Y = 30) ,All-Branches Coverage of P,25,Branch Testing:weaknesses,Branch testing is one level up from statement testing in degree of coverage same problem in achieving 100% coverage,26,2,3,4,5,6,9b,10,12,14,T,T,F,F,9a,T,F,7,T,F,At least 3 test cases needed,(X = 20, Y = 20) 5T,7T,9aF,9bT (X = 15, Y = 10) 5T,7F,9aT,9bF (X = 9, Y = 10) 5F,7F,9aT,9bF,Condition Coverage of P,X 10 X = 10 Y 20 X mod 2=0,27,Condition Coverage,Generate test data such that all conditions in a decision take on both outcomes (if possible) at least once May not achieve branch coverage: consider while (x 20 ) x = 0 causes first true, second false x = 34 causes first false, second true,28,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,29,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,F,4 test cases needed,(X = 10, Y = 10) (X = 10, Y = 20) (X = 20, Y = 10) (X = 15, Y = 10),Basic-paths Coverage of P,30,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; 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,31,2,3,4,5,6,9b,10,12,14,T,T,F,F,9a,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 Coverage of P,32,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,33,All-Paths testing,Generate test data to exercise all distinct paths in a program! a path that makes i iterations through a 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!,34,All-Paths testing (cont.),包含的不同執(zhí)行路徑數(shù)達(dá)520條,對每一條路徑進(jìn)行測試需要1毫秒,假定一年工作365 24小時(shí),要想把所有路徑測試完,需3170年,35,2,3,4,5,6,9b,10,12,14,T,F,9a,T,F,Y,X,X,Y,Y,X,X,Y,Y,X,X,X,T,F,7,T,F,X,X,Ps Control and Data Flow Graph,36,How many test cases are needed?,2,3,4,5,6,9b,10,12,14,T,F,9a,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,37,all-statements,all-edges,boundary-interior loop 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,38,Black Box Test,Equivalence Class Boundary Analysis ,39,Testing Levels,Testing occurs throughout lifecycle Unit Integration System Acceptance Regression,40,Overall Approach,Unit testing (module) Integration testing System testing Acceptance testing,White / Black box Black box Black box - requirements Black box - performance,41,Section 2 Estimating Number of Test Case & Allocating Test Times,42,Estimate No. of 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,43,Example,Development budget: $4 million, %10 of which spent 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 = min (N1 , N2), therefore, N = 1,250,44,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,45,Test Time: Systems /1,Allocate less than 10% of the remaining time to 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,46,Test Time: Systems /2,Example: Total test time: 340 h Test case proportion: Associated 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,47,Test Case Invocation,In what order the system should be tested? Recommended sequence of system test: Acquired components (certification test only) Developed product Other systems, OS, etc. (load test only),48,Section 3 Test Coverage Metrics,49,Test Coverage Metrics /1,Coverage of what? Statement coverage Branch coverage Component/Module coverage Specification coverage GUI coverage ,50,Test Coverage /1,Statement coverage (CVs) Portion of the statements tested by at least one test case.,51,Test Coverage /2,Branch coverage (CVb) Portion of the branches in the program tested by at least one test case.,52,Test Coverage /3,Component coverage (CVcm) Portion of the components in the software covered and tested by at least one test case,53,Test Coverage /4,GUI coverage (CVGUI) 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 case.,54,Test Pass, Failure & Pending Rate/1,Test Pass Rate (Rtp) Portion of the test cases that were executed successfully (i.e., produced expected output).,55,Test Pass, Failure & Pending Rate/2,Test Failure Rate (Rtf) Portion of the test cases that were not executed successfully
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 基于中醫(yī)古籍的小兒汗證中醫(yī)診療輔助決策方案研究
- 電子商務(wù)促銷技術(shù)和服務(wù)響應(yīng)方案-范文
- 2025年二次離婚協(xié)議書范文參考
- 2025年英語教師信息化教學(xué)研修計(jì)劃
- 租賃合同延期執(zhí)行申請書范文
- 礦山采掘技術(shù)畢業(yè)實(shí)習(xí)報(bào)告范文
- 設(shè)備維修請示報(bào)告范文
- 一年級上冊書法教學(xué)計(jì)劃
- 醫(yī)藥企業(yè)突發(fā)事件應(yīng)急預(yù)案演練計(jì)劃
- 護(hù)理專業(yè)護(hù)理質(zhì)量評估開題報(bào)告范文
- 9日益重要的國際組織(第3課時(shí)) 教學(xué)設(shè)計(jì)-六年級下冊道德與法治
- 浙江省慈溪市2024年小升初語文真題試卷及答案
- 2023年上海高中學(xué)業(yè)水平合格性考試歷史試卷真題(含答案詳解)
- 2024-2030年中國商品混凝土行業(yè)市場發(fā)展分析及發(fā)展趨勢與投資發(fā)展前景研究報(bào)告
- CJJT259-2016 城鎮(zhèn)燃?xì)庾詣踊到y(tǒng)技術(shù)規(guī)范
- 病案首頁填寫及質(zhì)控要求
- 18 設(shè)計(jì)緊急避難路線圖(教案)人美版(北京)(2012)美術(shù)三年級下冊
- 園林綠化移樹合同
- 排球大單元計(jì)劃教學(xué)設(shè)計(jì)-高一上學(xué)期體育與健康人教版
- 玻璃粉燒工藝
- 云計(jì)算和邊緣計(jì)算在工業(yè)互聯(lián)網(wǎng)中的融合
評論
0/150
提交評論