【正文】
? 2020 by SEC Chapter 6 Software Testing 助教翻譯 2 ? 2020 by SEC Chapter 6 Software Testing Software Testing Fundamentals 軟體測試基礎(chǔ) What is Software Testing 何謂軟體測試 Verification and Validation 驗(yàn)證與確認(rèn) The V Model V模型 Testing Principles 測試原則 Testing Techniques 測試技術(shù) WhiteBox Testing Techniques 白箱測試 BlackBox Testing Techniques 黑箱測試 3 ? 2020 by SEC Chapter 6 Software Testing (cont’d) Software Testing Strategies 軟體測試策略 Unit Testing 單元測試 Integration Testing 整合測試 System Testing 系統(tǒng)測試 Acceptance Testing 驗(yàn)收測試 ObjectOriented Testing 物件導(dǎo)向測試 References 4 ? 2020 by SEC Software Testing Fundamentals 軟體測試基礎(chǔ) ? What is software testing?什麼是軟體測試 – Myers: The process of executing a program with the intent of finding – Beizer: The act of designing and executing 的動作 – Whittaker: The process of executing a software system to determine whether it matches its specification and executes in its intended environment 一個用來檢視是否符合 (需求 )規(guī)格並於設(shè)定的環(huán)境執(zhí)行軟體系統(tǒng)的程序 – IEEE: The process of operating a system or ponent under specified conditions, observing or recording the results, and making an evaluation of some aspect of system or ponent. 於特定的條件下操作一個系統(tǒng)或元件,觀察或記錄結(jié)果,以評估系統(tǒng)或元件是否有某方面的問題 5 ? 2020 by SEC Software Testing Fundamentals (cont’d) ? Why do we test? 為何要測試 – To check if there are any errors in a part or a product. 檢查產(chǎn)品或某部分是否有錯誤 – To gain the confidence in the correctness of the product. 增加對產(chǎn)品正確的信心程度 – To ensure the quality and satisfaction of the product 確保產(chǎn)品品質(zhì)與滿意度 ? Testing vs. debugging 測試 vs. 除錯 – Testing is to show that a program has bugs 測試只是證實(shí)程式有無錯誤 – Debugging is to locate and correct the error or misconception that cause the program failures 除錯是找到錯誤所在並改正錯誤 6 ? 2020 by SEC Software Testing Fundamentals (cont’d) ? Who Tests the Software? 誰來測試軟體 – Development engineers 開發(fā)人員 ? Understand the system, but test ―gently‖ 了解系統(tǒng),但客氣地測試 ? Driven by ―delivery‖ 以釋出為目的 ? Only perform unit tests and integration tests 一般只做單元測試及整合測試 – Test engineers 測試工程師 (負(fù)責(zé)系統(tǒng)測試 ) ? Need to learn the system, but attempt to break it 需要瞭解系統(tǒng),但想盡辦法破壞系統(tǒng) ? Driven by ―quality‖ 以品質(zhì)為目的 ? Define test cases, write test specifications, run tests, analyze results 設(shè)計測試案例、寫測試規(guī)格、執(zhí)行測試、分析測試 – Customers 客戶 (負(fù)責(zé)驗(yàn)收測試 ) ? Driven by ―requirements‖ 需求為目的 ? Determine if the system satisfies the acceptance criteria 決定系統(tǒng)是否滿足驗(yàn)收標(biāo)準(zhǔn) 7 ? 2020 by SEC Test Cases測試案例 ? Usually a test case includes input data and expected results. 通常測試案例包含輸入的資料與預(yù)期的結(jié)果。 8 ? 2020 by SEC How to do Software Testing? 如何做軟體測試 ? Software testing can be approached in the following phases 軟體測試可以下面的階段來進(jìn)行 – Modeling the software‘s environment 建置軟體環(huán)境 – Selecting test scenario 選擇測試情節(jié) – Running and evaluating test scenario 執(zhí)行與評估情節(jié) – Measuring testing progress 評量測試進(jìn)度 9 ? 2020 by SEC Verification and Validation 驗(yàn)證與確認(rèn) ? Software testing is one element of a broader topic: verification and validation (Vamp。V) 軟體測試是一個更廣的議題「驗(yàn)證與確認(rèn)」的一部分 ? Verification – are we building the product correctly? 驗(yàn)證 –把產(chǎn)品做得正確無誤了嗎 ? – The set of activities to ensure that software correctly implements specific functions 確認(rèn)軟體可以正確地執(zhí)行特定功能的一些活動 ? Validation – are we building the correct product? 確認(rèn) – 做了對的產(chǎn)品了嗎 ? (是否做了真正要的產(chǎn)品 ) – The set of activities to ensure that the developed software is traceable to customer requirements 確認(rèn)所開發(fā)的軟體可以追溯到客戶需求的一些活動 Note: [Boehm 1981] 10 ? 2020 by SEC Verification and Validation (cont’d) ? The definition of Vamp。V enpasses many activities that is referred to as software quality assurance (SQA) including – Formal technical review – Quality and configuration audits – Performance monitoring – Simulation – Feasibility study – Documentation review – Database review – Algorithm analysis – Development testing – Qualification testing – Installation testing 11 ? 2020 by SEC The V model ? The V model – Emerged in reaction to some waterfall models that showed testing as a single phase following the traditional development phases of requirements analysis, highlevel design, detailed design and coding. V模型的出現(xiàn)是為了反應(yīng)某一些瀑布模型,將測試視為單一階段,緊接在需求分析、高階設(shè)計、細(xì)部設(shè)計、編寫程式碼之後的情形。 – The V model portrays several distinct testing levels and illustrates how each level addresses a different stage of the software lifecycle. V模型描述一些不同測試的層級 , 及軟體生命週期中對應(yīng)的 (開發(fā) )階段。 – The V shows the typical sequence of development activities on the lefthand (downhill) side and the corresponding sequence of test execution activities on the righthand (uphill) side. V模型的左側(cè)顯示開發(fā)階段的活動順序 (往下 ) ,右邊則是與其相對應(yīng)的測試活動 (往上 ) 。 12 ? 2020 by SEC The V model (cont’d) Requirements Analysis Architecture Design Detailed Design Code Integration Testing Acceptance Testing System Testing Unit Testing 13 ? 2020 by SEC (續(xù) ) 需求分析 架構(gòu)設(shè)計 細(xì)部設(shè)計 程式寫作 整合測試 驗(yàn)收測試 系統(tǒng)測試 單元測試 14 ? 2020 by SEC The V model (cont’d) ? The V model is valuable because it highlights the existence of several levels of testing and delineates how each relates to a different development phase: V模型是有價值的,因?yàn)樗鼜?qiáng)調(diào)測試的層級性,而且描述各測試層級與開發(fā)階段之間的相關(guān)性: – Unit testing: concentrates on each unit (., ponent) of the software (white box testing). 單元測試:專注於每一個軟體的單元 (也就是元件 ) (白箱測試 ) – Integration testing: focuses on design and the construction of the software architecture (black box testing, limited amount of white box testing). 整合測試:專注於設(shè)計與軟體架構(gòu)的建構(gòu) (黑箱測試,限量的白箱測試 ) 。 15 ? 2020 by SEC The V model (cont’d) – System testing: verifies that all elements mesh properly and that overall system function/performance is achieved. 系統(tǒng)測試:驗(yàn)證 (系統(tǒng) )所有元素都適當(dāng)?shù)鼐o密配合,且全面性的系統(tǒng)功能 /績效都達(dá)成。 – Acceptance testing: are ordinarily performed by the business/users to confirm that the product meets the bus