defect testing

35
Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 1 Defect testing Testing programs to establish the presence of system defects

Upload: mahinth-christensen

Post on 13-Jan-2015

982 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 1

Defect testing

Testing programs to establish the presence of system defects

Page 2: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 2

Objectives

To understand testing techniques that are geared to discover program faultsTo introduce guidelines for interface testingTo understand specific approaches to object-oriented testingTo understand the principles of CASE tool support for testing

Page 3: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 3

Topics covered

Defect testingIntegration testingObject-oriented testingTesting workbenches

Page 4: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 4

The testing process

Component testing • Testing of individual program components• Usually the responsibility of the component developer (except

sometimes for critical systems)• Tests are derived from the developer’s experience

Integration testing• Testing of groups of components integrated to create a system

or sub-system• The responsibility of an independent testing team• Tests are based on a system specification

Page 5: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 5

Testing phases

Componenttesting

Integrationtesting

Software developer Independent testing team

Page 6: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 6

Defect testing

The goal of defect testing is to discover defects in programsA successful defect test is a test which causes a program to behave in an anomalous wayTests show the presence not the absence of defects

Page 7: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 7

Only exhaustive testing can show a program is free from defects. However, exhaustive testing is impossibleTests should exercise a system's capabilities rather than its componentsTesting old capabilities is more important than testing new capabilitiesTesting typical situations is more important than boundary value cases

Testing priorities

Page 8: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 8

Test data Inputs which have been devised to test the systemTest cases Inputs to test the system and the predicted outputs from these inputs if the system operates according to its specification

Test data and test cases

Page 9: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 9

The defect testing process

Design testcases

Prepare testdata

Run programwith test data

Compare resultsto test cases

Testcases

Testdata

Testresults

Testreports

Page 10: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 10

Black-box testing

An approach to testing where the program is considered as a ‘black-box’The program test cases are based on the system specification Test planning can begin early in the software process

Page 11: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 11

Black-box testing

Ie

Input test data

OeOutput test results

System

Inputs causinganomalousbehaviour

Outputs which revealthe presence ofdefects

Page 12: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 12

Sometime called white-box testingDerivation of test cases according to program structure. Knowledge of the program is used to identify additional test casesObjective is to exercise all program statements (not all path combinations)

Structural testing

Page 13: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 13

White-box testing

Componentcode

Testoutputs

Test data

DerivesTests

Page 14: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 14

Path testing

The objective of path testing is to ensure that the set of test cases is such that each path through the program is executed at least onceThe starting point for path testing is a program flow graph that shows nodes representing program decisions and arcs representing the flow of controlStatements with conditions are therefore nodes in the flow graph

Page 15: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 15

Integration testing

Tests complete systems or subsystems composed of integrated componentsIntegration testing should be black-box testing with tests derived from the specificationMain difficulty is localising errorsIncremental integration testing reduces this problem

Page 16: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 16

Incremental integration testing

T3

T2

T1

T4

T5

A

B

C

D

T2

T1

T3

T4

A

B

C

T1

T2

T3

A

B

Test sequence1

Test sequence2

Test sequence3

Page 17: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 17

Approaches to integration testing

Top-down testing• Start with high-level system and integrate from the top-down

replacing individual components by stubs where appropriateBottom-up testing• Integrate individual components in levels until the complete

system is createdIn practice, most integration involves a combination of these strategies

Page 18: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 18

Top-down testing

Level 2Level 2Level 2Level 2

Level 1 Level 1Testing

sequence

Level 2stubs

Level 3stubs

. . .

Page 19: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 19

Testing approaches

Architectural validation• Top-down integration testing is better at discovering errors in

the system architectureSystem demonstration• Top-down integration testing allows a limited demonstration at

an early stage in the developmentTest implementation• Often easier with bottom-up integration testing

Test observation• Problems with both approaches. Extra code may be required to

observe tests

Page 20: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 20

Takes place when modules or sub-systems are integrated to create larger systemsObjectives are to detect faults due to interface errors or invalid assumptions about interfacesParticularly important for object-oriented development as objects are defined by their interfaces

Interface testing

Page 21: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 21

Interface testingTestcases

BA

C

Page 22: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 22

Interfaces types

Parameter interfaces• Data passed from one procedure to another

Shared memory interfaces• Block of memory is shared between procedures

Procedural interfaces• Sub-system encapsulates a set of procedures to be called by

other sub-systemsMessage passing interfaces• Sub-systems request services from other sub-systems

Page 23: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 23

Interface errors

Interface misuse• A calling component calls another component and makes an

error in its use of its interface e.g. parameters in the wrong order

Interface misunderstanding• A calling component embeds assumptions about the behaviour

of the called component which are incorrectTiming errors• The called and the calling component operate at different

speeds and out-of-date information is accessed

Page 24: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 24

Interface testing guidelines

Design tests so that parameters to a called procedure are at theextreme ends of their rangesAlways test pointer parameters with null pointersDesign tests which cause the component to failUse stress testing in message passing systemsIn shared memory systems, vary the order in which components areactivated

Page 25: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 25

Stress testing

Exercises the system beyond its maximum design load. Stressing the system often causes defects to come to lightStressing the system test failure behaviour.. Systems should not fail catastrophically. Stress testing checks for unacceptable loss ofservice or dataParticularly relevant to distributed systems which can exhibit severe degradation as a network becomes overloaded

Page 26: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 26

The components to be tested are object classes that are instantiated as objectsLarger grain than individual functions so approaches to white-box testing have to be extendedNo obvious ‘top’ to the system for top-down integration and testing

Object-oriented testing

Page 27: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 27

Testing levels

Testing operations associated with objectsTesting object classesTesting clusters of cooperating objectsTesting the complete OO system

Page 28: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 28

Object class testing

Complete test coverage of a class involves• Testing all operations associated with an object• Setting and interrogating all object attributes• Exercising the object in all possible states

Inheritance makes it more difficult to design object class tests as the information to be tested is not localised

Page 29: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 29

Approaches to cluster testing

Use-case or scenario testing• Testing is based on a user interactions with the system• Has the advantage that it tests system features as experienced

by usersThread testing• Tests the systems response to events as processing threads

through the systemObject interaction testing• Tests sequences of object interactions that stop when an object

operation does not call on services from another object

Page 30: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 30

Scenario-based testing

Identify scenarios from use-cases and supplement these with interaction diagrams that show the objects involved in the scenario

Page 31: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 31

Testing workbenches

Testing is an expensive process phase. Testing workbenches provide a range of tools to reduce the time required and total testing costsMost testing workbenches are open systems because testing needs are organisation-specificDifficult to integrate with closed design and analysis workbenches

Page 32: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 32

A testing workbench

Dynamicanalyser

Programbeing tested

Testresults

Testpredictions

Filecomparator

Executionreport Simulator

Sourcecode

Testmanager Test data Oracle

Test datagenerator Specification

Reportgenerator

Test resultsreport

Page 33: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 33

Tetsing workbench adaptation

Scripts may be developed for user interface simulators and patterns for test data generatorsTest outputs may have to be prepared manually for comparisonSpecial-purpose file comparators may be developed

Page 34: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 34

Key points

Test parts of a system which are commonly used rather than thosewhich are rarely executedEquivalence partitions are sets of test cases where the program should behave in an equivalent wayBlack-box testing is based on the system specificationStructural testing identifies test cases which cause all paths through the program to be executed

Page 35: Defect Testing

Nitin V Pujari B.E – CS - Software Engineering – Defect Testing Slide 35

Key pointsTest coverage measures ensure that all statements have been executed at least once. Interface defects arise because of specification misreading, misunderstanding, errors or invalid timing assumptionsTo test object classes, test all operations, attributes and statesIntegrate object-oriented systems around clusters of objects