Pa chapter08-testing integrating-the_programs-cs_390
-
Upload
rana-tallal -
Category
Technology
-
view
251 -
download
0
Transcript of Pa chapter08-testing integrating-the_programs-cs_390
![Page 1: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/1.jpg)
ISBN 0-13-146913-4Prentice-Hall, 2006
Program Testing + Integration Testing
Zeeshan Rana
![Page 2: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/2.jpg)
Types of faults and how to clasify them The purpose of testing Unit testing Integration testing strategies Test planning When to stop testing
Chapter 8 Objectives
![Page 3: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/3.jpg)
Wrong requirement: not what the customer wants
Missing requirement Requirement impossible to implement Faulty design Faulty code Improperly implemented design
8.1 Software Faults and FailuresWhy Does Software Fail?
![Page 4: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/4.jpg)
Objective of testing: discover faults A test is successful only when a fault is
discovered◦ Fault identification is the process of determining
what fault caused the failure◦ Fault correction is the process of making changes
to the system so that the faults are removed
8.1 Software Faults and Failures Objective of Testing
![Page 5: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/5.jpg)
Purpose Input Expected Output Actual Output Sample Format:
Elements of a Test Case
![Page 6: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/6.jpg)
Algorithmic fault Computation and precision fault
◦ a formula’s implementation is wrong Documentation fault
◦ Documentation doesn’t match what program does Capacity or boundary faults
◦ System’s performance not acceptable when certain limits are reached
Timing or coordination faults Performance faults
◦ System does not perform at the speed prescribed
8.1 Software Faults and FailuresTypes of Faults
![Page 7: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/7.jpg)
An algorithmic fault occurs when a component’s algorithm or logic does not produce proper output◦ Branching too soon◦ Branching too late◦ Forgetting to initialize variable or set loop
invariants◦ Comparing variables of inappropriate data types
8.1 Software Faults and FailuresTypical Algorithmic Faults
![Page 8: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/8.jpg)
Module testing, component testing, or unit testing
Integration testing System Testing
◦ Function testing◦ Performance testing
Acceptance testing Installation testing
Levels of Testing
![Page 9: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/9.jpg)
Levels of TestingTesting Organization Illustrated
![Page 10: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/10.jpg)
Egoless programming: programs are viewed as components of a larger system, not as the property of those who wrote them
8.2 Testing IssuesAttitude Toward Testing
![Page 11: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/11.jpg)
Independent test team◦ avoid conflict◦ improve objectivity◦ allow testing and coding concurrently
8.2 Testing IssuesWho Performs the Test?
![Page 12: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/12.jpg)
Closed box or black box: functionality of the test objects◦ Equivalence Class, Boundary Value Analysis,
Scenario-based, Decision Table based, State Machine based…
Clear box or white box: structure of the test objects ◦ Control Flow
Basis Path, Branch, Statement, Decision…◦ Data Flow
Du Path, All-uses Path
8.2 Testing IssuesViews of the Test Objects
![Page 13: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/13.jpg)
Black box: external behavior description State box: black box with state information White box: state box with a procedure
8.2 Testing IssuesSidebar 8.2 Box Structures
![Page 14: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/14.jpg)
Code walkthrough Code inspection
8.3 Unit TestingCode Review
![Page 15: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/15.jpg)
Testing the unit for correct functionality Testing the unit for correct execution
8.3 Unit Testing
![Page 16: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/16.jpg)
Determining test objectives Selecting test cases Executing test cases
8.3 Unit TestingSteps in Testing
![Page 17: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/17.jpg)
Statement testing Branch testing Path testing …
8.3 Unit TestingWhitebox Test Thoroughness
![Page 18: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/18.jpg)
Whitebox TestingControl Flow Graph
Cyclomatic Complexity = E – N + 2 = 9 – 9 + 2 = 2
![Page 19: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/19.jpg)
8.3 Unit TestingComparing Techniques
• Effectiveness of fault-discovery techniques
Requirements Faults Design Faults
Code Faults
Documentation Faults
Reviews Fair Excellent Excellent Good
Prototypes Good Fair Fair Not applicable
Testing Poor Poor Good Fair
Correctness Proofs Poor Poor Fair Fair
![Page 20: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/20.jpg)
Big-bang Bottom-up Top-down Sandwich testing
8.4 Integration Testing
![Page 21: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/21.jpg)
Component Driver: a routine that calls a particular component and passes a test case to it
Stub: a special-purpose program to simulate the activity of the missing component
8.4 Integration TestingTerminology
![Page 22: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/22.jpg)
System viewed as a hierarchy of components
8.4 Integration TestingView of a System
![Page 23: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/23.jpg)
All components integrated at once Locating faults?
8.4 Integration Testing Bing-Bang Integration Example
![Page 24: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/24.jpg)
Only A is tested by itself Stubs of B, C and D are used at first level N-1 stubs required (N=Number of nodes) Locating faults?
8.4 Integration TestingTop-Down Integration Example
![Page 25: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/25.jpg)
Drivers are used to call the child functions Drivers are relatively intelligent N-leaves drivers Locating faults?
8.4 Integration TestingBottom-Up Integration Example
![Page 26: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/26.jpg)
Viewed system as three layers Employ BU where writing drivers is not costly
Employ TD wherestubs are easier toWrite Locating faults?
8.4 Integration Testing Sandwich Integration Example
![Page 27: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/27.jpg)
Integration TestingCall-Graph Based Testing
• Adjacency Matrix• NxN matrix that tells which components call
the other components• Pairwise Integration
• Test each pair (i.e. each edge)• E testing sessions
• Neighborhood based Integration• Integrate each neighborhood
• The nodes at one edge distance from the node to be integrated
• N-sink nodes sessions
![Page 28: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/28.jpg)
Establish test objectives Design and Write test cases Test test cases Execute tests Evaluate test results
8.6 Test Planning
![Page 29: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/29.jpg)
Test plan explains◦ who does the testing◦ why the tests are performed◦ how tests are conducted◦ when the tests are scheduled
8.6 Test PlanningPurpose of the Plan
![Page 30: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/30.jpg)
What the test objectives are How the test will be run What criteria will be used to determine
when the testing is complete
8.6 Test PlanningContents of the Plan
![Page 31: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/31.jpg)
Automated Testing Tools Testing Management Tools Bug Tracking/Configuration Management
Tools
Software Testing Tools
![Page 32: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/32.jpg)
No time left No money left Statistical Criteria
◦ Number of defects found per week becomes lower than a set threshold
8.8 When to Stop Testing
![Page 33: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/33.jpg)
The Ariane-5’s flight control system was tested in four ways◦ equipment testing◦ on-board computer software testing◦ staged integration◦ system validation tests
The Ariane-5 developers relied on insufficient reviews and test coverage
8.10 Real-Time ExampleThe Ariane-5 System
![Page 34: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/34.jpg)
It is important to understand the difference between faults and failures
The goal of testing is to find faults, not to prove correctness
8.11 What this Chapter Means for You
![Page 35: Pa chapter08-testing integrating-the_programs-cs_390](https://reader036.fdocuments.us/reader036/viewer/2022070316/555a62ccd8b42a972b8b457f/html5/thumbnails/35.jpg)
UCF Slides Software Testing, A Craftsman’s Approach
by Jorgensen Software Testing Tools by Prasad
References