pa chapter08-testing integrating-the_programs-cs_390

35
ISBN 0-13-146913-4 Prentice-Hall, 2006 Program Testing + Integration Testing Zeeshan Rana

Upload: rana-tallal

Post on 19-May-2015

250 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Pa chapter08-testing integrating-the_programs-cs_390

ISBN 0-13-146913-4Prentice-Hall, 2006

Program Testing + Integration Testing

Zeeshan Rana

Page 2: Pa chapter08-testing integrating-the_programs-cs_390

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

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

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

Purpose Input Expected Output Actual Output Sample Format:

Elements of a Test Case

Page 6: Pa chapter08-testing integrating-the_programs-cs_390

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

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

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

Levels of TestingTesting Organization Illustrated

Page 10: Pa chapter08-testing integrating-the_programs-cs_390

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

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

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

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

Code walkthrough Code inspection

8.3 Unit TestingCode Review

Page 15: Pa chapter08-testing integrating-the_programs-cs_390

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

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

Statement testing Branch testing Path testing …

8.3 Unit TestingWhitebox Test Thoroughness

Page 18: Pa chapter08-testing integrating-the_programs-cs_390

Whitebox TestingControl Flow Graph

Cyclomatic Complexity = E – N + 2 = 9 – 9 + 2 = 2

Page 19: Pa chapter08-testing integrating-the_programs-cs_390

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

Big-bang Bottom-up Top-down Sandwich testing

8.4 Integration Testing

Page 21: Pa chapter08-testing integrating-the_programs-cs_390

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

System viewed as a hierarchy of components

8.4 Integration TestingView of a System

Page 23: Pa chapter08-testing integrating-the_programs-cs_390

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

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

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

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

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

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

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

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

Automated Testing Tools Testing Management Tools Bug Tracking/Configuration Management

Tools

Software Testing Tools

Page 32: Pa chapter08-testing integrating-the_programs-cs_390

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

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

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

UCF Slides Software Testing, A Craftsman’s Approach

by Jorgensen Software Testing Tools by Prasad

References