1 / 33

單元 5 :軟體測試與驗證

單元 5 :軟體測試與驗證. Outline. Introduction Strategies Exercise. Testing. To demonstrate to the developer and the customer that software meets its requirement ( 是否合乎需求 )

Download Presentation

單元 5 :軟體測試與驗證

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 單元5:軟體測試與驗證

  2. Outline • Introduction • Strategies • Exercise

  3. Testing • To demonstrate to the developer and the customer that software meets its requirement (是否合乎需求) • Testing is a fault detection technique that tries to create failures or erroneous states in a planned way.(Testing就是試著弄壞系統找出Bug)

  4. Test Stubs & Test Driver • Test Stubs: If the function A you are testing calls another function B,then use a simplified version of function B, called a stub.(虛構的程式方法) • Test driver – allows you to call a function and display its return values.(可以啟動你的程式,並驗證回傳結果) Test Driver YourFunction Test Stub • int main() { • //呼叫被測試程式 • … • //驗證結果 • … • } • int YourOtherFunction() • { • return 1; • } • int YourFunction(){ • //呼叫其他程式 • … • … • } YourOtherFunction YourFunction

  5. Software Lift Cycle Software Life Cycle Development cycle Unit Testing Integration Testing System Testing Requirements Engineering Design Implementation Testing Requirements Elicitation System Design Analysis Object Design Testing Plan (Test case) Testing Report Maintenance

  6. Bug • Fault –又稱作bug或defect (缺陷),是design或coding錯誤導致反常的結果 • Erroneous state –有fault在系統執行中發生 • Failure –系統實際的行為與預計不同,通常由1個以上的erroneous state導致 System view User View Design/Implement Time Runtime Time Software Software Software Failure Erroneous state Fault(Bug, Defect)

  7. Testing Strategies • Testing Plan –包含測試相關資訊、測試種類、test case與測試進度(IEEE 829) • Testing Report –測試報告 Testing Software developer ( 程式開發者 ) Testing Report (測試結果報告) Testing Plan (測試計劃) Unit Testing (單元測試) Integration Testing (整合測試) Test Case Result (試案案例的結果) Test Case (試案案例) Independent testing team ( 獨立測試小組 ) Bug Report (問題報告) System Testing(系統測試)

  8. Bug Report

  9. Test Case • 設計一個情況(Condition),然而軟體程式在這種情況下,必須能夠正常運作並且達到程式所設計的執行結果(Expect Result)。 • 如果程式在這種情況下並不能正常運作,而且這種問題是能夠被重複產生的(Reproducible),那表示軟體程式人員已經測出軟體有瑕疵(Bug),這時候就必須將這個問題標示出來,並且輸入至問題追蹤系統(Bug Tracking System)內,通知軟體開發人員。

  10. Test Case Design • 原則 • Involves designing the test cases (inputs and outputs) used to test the system. (設計測試案例要有輸入輸出) • Design inputs that cause buffers to overflow. (設計會產生overflow的資料) • Force computation results to be too large or too small. (選擇很大與很小的資料去測試) • 方針 • Equivalence Testing • Path Testing

  11. Requirement

  12. Test Case

  13. Test Case – I/O Form

  14. Equivalence Testing • The program behaves in an equivalent way for equivalence partition. (同區塊的資料效力視為等價) • Test cases should be chosen from each partition. (所有部份需要被選取) • Requirement:臨時帳號密碼的長度限定為2-6碼 Boundary Boundary 7 2 6 1 4

  15. Path Testing • Execute each possible path • Not practical with many nested conditionals • Impossible for most loops

  16. Path Testing • 測試活動圖每一個可能路徑 • 修改學生資料正確路徑 學生點選修改資料 錯誤 正確 顯示修改學生資料表單 輸入修改資料後送出 更新學生資料 寄發確認電子郵件 驗證學生資料 顯示修改完成訊息

  17. Path Testing • 測試活動圖每一個可能路徑 • 修改學生資料例外路徑 學生點選修改資料 錯誤 正確 顯示修改學生資料表單 輸入修改資料後送出 更新學生資料 寄發確認電子郵件 驗證學生資料 顯示修改完成訊息

  18. Unit Testing (Component Testing) • Testing individual subsystems (collection of classes) • Goal: Confirm that subsystem is correctly coded and carries out the intended functionality System Design Document Subsystem Code Unit Test

  19. Unit Testing • /* 帳號的長度限定為 1 到 6 個字元*/ • class system{ • bool ValidateUserID(const char* userID){ • int num = strlen(userID); • return (num >= 1 )&& (num <=5 ); • } • } 寫好一個物件的功能 決定決定測試資料 開始測試 測試結果第四項目不符合表示程式有錯

  20. Integration Testing • Testing groups of subsystems and eventually the entire system • Goal: Test interfaces between subsystems System Design Document Subsystem Code Subsystem Code Integration Test Subsystem Code

  21. Integration Testing • Integration testing detects faults that have not been detected during unit testing by focusing on small groups of components. (integration testing測試的單位為一群components) • Two or more components are integrated and tested, and when no new faults are revealed, additional components are added to the group. (先從兩個以上有關聯的component當作一個群組開始測試,該群組沒發現新bug後才增加其他有關聯的component進入該群組) • Strategies • Bottom-Up Strategy • Top-Down Strategy • Sandwich Strategy

  22. Bottom-Up Strategy • Strategy • Start with subsystems in lowest layer of call hierarchy • Test subsystems that call the previously tested subsystems • Repeat until all subsystems are included • Advantage • Interface faults can be more easily found. (開發者可控制一個component,掌握該component與相關底層component的inputs、outputs,故容易從component的interface找出faults) • Disadvantage • Faults found in the top layer may often lead to changes in the subsystem interfaces of lower layers. (越往頂層發現的錯誤牽連越廣,要修正的地方越多)

  23. Bottom-Up Strategy MSSQL Database Server DML Interface Test ODBC/ADO DML Application Test Server-U FTP Service Server-U FTP Service ODBC/ADO ASPUpload ASPUpload Test IIS Web Server MSSQL Database Server IIS Web Server Test DML Application DML Interface Test

  24. Top-Down Strategy • Strategy • Start with subsystems in top layer of call hierarchy • Include subsystems that are called by the previously tested subsystems • Repeat until all subsystems are included Advantage • Advantage • It starts with user interface components. Supports test cases for the functionality of the system. (由使用者觀點進行測試) • Disadvantage • The development of test stubs is time-consuming and prone to error. (製作一堆test stub,費時又容易發生錯誤)

  25. Top-Down Strategy DML Application DML Interface Test DML Interface DML Application Test ASPUpload Server-U FTP Service ODBC/ADO ASPUpload Test ODBC/ADO IIS Web Server MSSQL Database Server Server-U FTP Service Test MSSQL Database Server IIS Web Server

  26. SandwichStrategy • Combines top-down with bottom-up strategy • Advantage • Many testing activities can be performed in parallel. (Top-down與Bottom-up可同時進行) • It lead to a significantly shorter overall testing time than top-down or bottom-up testing. (Sandwich strategy花費的測試時間比Top-down或是Bottom-up都短) • Disadvantage • It is the need for additional test stubs. (依然會有製作test stub所產生的缺點)

  27. Sandwichstrategy DML Application DML Interface Test DML Interface DML Application ASPUpload Server-U FTP Service ODBC/ADO ASPUpload Test IIS Web Server IIS Web Server MSSQL Database Server MSSQL Database Server Test ODBC/ADO Test Test Server-U FTP Service

  28. System Testing • Testing the entire system • System testing is a black-box technique. (黑箱測試的test case是根據use case而來) • Goal: Determine if the system meets the requirements (functional and non-functional) Requirements Specification Entire System System Test

  29. Functional Testing 2 2 • The goal of the tester is to select valid and invalid inputs that are relevant to the user and have a high probability of uncovering a failure.(測試人員要以使用者角度選用各種可能發現failure的input進行測試) • Test cases are derived from the use cases. (test case依據use case而來) • We do not consider implementation details. (不需了解實做細節,只管inputs與results) • Impossible to generate all possible inputs 3 3 Input data Output data Expected Expected System 4 1 1 Invalid Invalid 4

  30. Non-functionalTesting • Product testing • Usability Testing • Performance Testing • Space Testing • Reliability Testing • Availability testing • Portability Testing • Organisational testing • Delivery Testing • Implementation Testing • Standards Testing • External Testing • Interoperability Testing • Ethical Testing • Privacy Testing • Safely Testing • Configuration Testing

  31. Performance Testing • Timing Testing(時間測試)Response times and time to perform a function • Stress Testing(壓力測試)Stress limits of system (maximum number of users, peak demands) • Recovery Testing(回復測試)System’s response to presence of errors or loss of data

  32. Tools for performance testing • WAPT 4.0 http://www.loadtestingtool.com/ • TestView http://www.radview.com/products/testview.asp • AdventNet QEngine Web Performance Test tool http://www.adventnet.com/products/qengine/web-performance-test.html

  33. Exercises • 試完成第20張投影片(Bottom-up)及第22張投影片(top-down)全部測試的順序 • 請依照教學網站作業功能製作I/O Form • 至教學網站下載testing plan進行system testing,需使用bugzilla進行bug report

More Related