Coupling-based Criteria for Integration Testing Journal of Software Testing, Verification, and Analysis, 8(3):133-154, September 1998, Jenny Jin and Jeff.

Slides:



Advertisements
Similar presentations
1 Software Unit Test Coverage And Test Adequacy Hong Zhu, Patrick A. V. Hall, John H.R. May Presented By: Arpita Gandhi.
Advertisements

1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Lecture 11 Instructor Paulo Alencar.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Graph Coverage for Design Elements 1.  Use of data abstraction and object oriented software has increased importance on modularity and reuse.  Therefore.
The Application of Graph Criteria: Source Code  It is usually defined with the control flow graph (CFG)  Node coverage is used to execute every statement.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 16, 1999.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
Introduction to Software Testing Chapter 5.2 Program-based Grammars Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 7.1 Engineering Criteria for Technologies Paul Ammann & Jeff Offutt
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
Software Testing and Maintenance Lecture 4 Graph Coverage for Design Element Paul Ammann & Jeff Offutt Instructor: Hossein Momeni Mazandaran.
Agenda Introduction Overview of White-box testing Basis path testing
Introduction to Software Testing Chapter 8.1 Building Testing Tools –Instrumentation Paul Ammann & Jeff Offutt
Concepts of Software Quality Yonglei Tao 1. Software Quality Attributes  Reliability  correctness, completeness, consistency, robustness  Testability.
Cohesion and Coupling CS 4311
637 – Introduction (Ch 1) Introduction to Software Testing Chapter 1 Jeff Offutt Information & Software Engineering SWE 437 Software Testing
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
1 Graph Coverage (4). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
Of 18 Is Bytecode Instrumentation as Good as Source Instrumentation? An Empirical Study with Industrial Tools Nan Li, Xin Meng, Jeff Offutt, and Lin Deng.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
1 Introduction to Software Testing. Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Chapter 1 2.
Software Verification Graph Model 2. 2 Graph Coverage Four Structures for Modeling Software Graphs Logic Input Space Syntax Use cases Specs Design Source.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Introduction to Software Testing Paul Ammann & Jeff Offutt Updated 24-August 2010.
Introduction to Software Testing (2nd edition) Chapter 7.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt
Introduction to Software Testing. OUTLINE Introduction to Software Testing (Ch 1) 2 1.Spectacular Software Failures 2.Why Test? 3.What Do We Do When We.
Introduction to Software Testing Chapter 7.1 Engineering Criteria for Technologies Paul Ammann & Jeff Offutt
Testing Inheritance & Polymorphism in OO Software using Formal Specification Presented by : Mahreen Aziz Ahmad (Center for Software Dependability, MAJU)
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Introduction to Software Testing Chapter 9.2 Program-based Grammars Paul Ammann & Jeff Offutt
Graph Coverage for Design Elements 1.  Use of data abstraction and object oriented software has increased importance on modularity and reuse.  Therefore.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
SAFEWARE System Safety and Computers Chap18:Verification of Safety Author : Nancy G. Leveson University of Washington 1995 by Addison-Wesley Publishing.
Dynamic Testing.
Control Flow Graphs : The if Statement 1 if (x < y) { y = 0; x = x + 1; } else { x = y; } x >= yx < y x = y y = 0 x = x + 1 if (x < y) { y = 0;
CS223: Software Engineering Lecture 21: Unit Testing Metric.
Chapter 2 : Graph Coverage (part 2)
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Software Testing and Quality Assurance Syntax-Based Testing (2) 1.
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Software Testing.
Paul Ammann & Jeff Offutt
Metrics of Software Quality
Testing Object-Oriented Software Test Coverage Criteria
Software Metrics 1.
Software Testing.
Generating Automated Tests from Behavior Models
White-Box Testing Pfleeger, S. Software Engineering Theory and Practice 2nd Edition. Prentice Hall, Ghezzi, C. et al., Fundamentals of Software Engineering.
Software Testing.
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Software Engineering (CSI 321)
Paul Ammann & Jeff Offutt
Types of Testing Visit to more Learning Resources.
Graph Coverage for Design Elements CS 4501 / 6501 Software Testing
Paul Ammann & Jeff Offutt
It is great that we automate our tests, but why are they so bad?
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 5.2 Program-based Grammars
Paul Ammann & Jeff Offutt
Graph Coverage for Design Elements CS 4501 / 6501 Software Testing
Sudipto Ghosh CS 406 Fall 99 November 16, 1999
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Presentation transcript:

Coupling-based Criteria for Integration Testing Journal of Software Testing, Verification, and Analysis, 8(3): , September 1998, Jenny Jin and Jeff Offutt. TOOLS USA 1999, Santa Barbara, CA, August 1999, Roger Alexander and Jeff Offutt. Jeff Offutt

CoupTest Systems 2 Motivation As OO is becoming increasingly prevalent, the emphasis on testing is shifting from unit and system to module and integration.  Module testing  OO testing  Integration testing

CoupTest Systems 3 Motivation FAA has recognized this by imposing requirements on structural coverage of software: “the analysis (testing) should confirm the data coupling and control coupling between the code components”

CoupTest Systems 4 Test Specifications & Requirements  Software Spec/Req -- What the software does Design -- How the software does it  Tests Requirements: Specific things that must be satisfied or covered (statements, branches, etc.) Criterion: A set of rules that imposes test requirements Coverage: Extent to which a criterion is satisfied

CoupTest Systems 5 Advantages of Formal Test Criteria n Formal basis for testing n Well defined stopping rules n Automation n Early development of tests Formal test criteria allow tests to be cheaper and better – reducing the risk of using the resulting software.

CoupTest Systems 6 Software Testing Levels  Unit and Module Testing: Testing individual procedures and groups of related procedures.  Integration Testing: Testing for interface problems and incompatibilities between objects.  System Testing: Testing a complete system from an external perspective.

CoupTest Systems 7 OO Testing Issues  Unit Testing  Testing is essentially the same  Must watch for “hidden” methods and operations  If reuse, must know extent of previous testing  Class and Integration Testing  More integration testing is necessary  Module testing at the class level is critical  More faults will be found  System Testing  Some specific techniques are helpful for OO

CoupTest Systems 8 Integration Testing  Do the components communicate correctly?  Do they make conflicting assumptions?  Do they leave anything out?

CoupTest Systems 9 Testing Interface Couplings  Integration testing is primarily about finding faults in the interfaces.  Interfaces are often measured by the couplings between classes.  Integration testing can be guided by covering these couplings.

CoupTest Systems 10 Coupling Overview  Coupling measures the dependency relations between two units. Reflects interconnections between units Faults in one unit may affect the coupled unit Faults in the interface affects both units  Coupling summarizes design and structure  Coupling has been found to be correlated with faults

CoupTest Systems 11 Old Coupling Types 0. Independent Coupling 1. Call Coupling 2. Scalar Data Coupling 3. Stamp Data Coupling 4. Scalar Control Coupling 5. Stamp Control Coupling 6. Scalar Data/Control Coupling 7. Stamp Data/Control Coupling 8. External Coupling 9. Non-Local Coupling 10. Global Coupling 11. Tramp Coupling

CoupTest Systems 12 Coupling-based Testing Terms  Caller  Callee  Actual Parameters  Formal Parameters  Interface A B (X); end A B (Y) end B The program must execute from definitions of actual parameters through calls to uses of formal parameters.

CoupTest Systems 13 Three Coupling Types  Parameter Coupling: Information passed by parameters.  Shared Data Coupling: Two procedures that refer to the same data object.  External Device Coupling: Two procedures that access the same external medium.

CoupTest Systems 14 Coupling-based Path Criteria  Parameter Coupling Path: For each actual parameter X and each last definition of X before a call-site, a path from the last definition through the call-site to each first use of the parameter.  Shared Data Coupling Path: For each shared data object G defined in A and used in B, and each definition of G in A, a path from the definition to each first use of G in B.  External Device Coupling Path: For each pair of references (i, j) to the same external device, both i and j must be executed on the same execution path.

CoupTest Systems 15 Coupling Paths Example 1-A procedure QUADRATIC is begin GET (Control_Flag); if Control_flag = 1 then GET (X, Y, Z); else X := 10; Y := 9; Z := 12; end if; OK := TRUE; ROOT (X, Y, Z, R1, R2, OK); if OK then PUT (R1, R2); else PUT (“No solution.”); end if; end QUADRATIC procedure ROOT ( A, B, C: in REAL; Root1, Root2 : out REAL; Result: in out BOOLEAN) is... D : REAL;... begin D := B**2-4.0*A*C; if Result and D < 0.0 then Result := FALSE; return; Root1 := (-B + sqrt(D)) / (2.0*A); Root2 := (-B - sqrt(D)) / (2.0*A); Result := TRUE; end ROOT

CoupTest Systems 16 Coupling Paths Example 1-B procedure QUADRATIC is begin GET (Control_Flag); if Control_flag = 1 then GET (X, Y, Z); else X := 10; Y := 9; Z := 12; end if; OK := TRUE; ROOT (X, Y, Z, R1, R2, OK); if OK then PUT (R1, R2); else PUT (“No solution.”); end if; end QUADRATIC procedure ROOT ( A, B, C: in REAL; Root1, Root2 : out REAL; Result: in out BOOLEAN) is... D : REAL;... begin D := B**2-4.0*A*C; if Result and D < 0.0 then Result := FALSE; return; Root1 := (-B + sqrt(D)) / (2.0*A); Root2 := (-B - sqrt(D)) / (2.0*A); Result := TRUE; end ROOT

CoupTest Systems 17 Coupling Paths Example 1-C procedure QUADRATIC is begin GET (Control_Flag); if Control_flag = 1 then GET (X, Y, Z); else X := 10; Y := 9; Z := 12; end if; OK := TRUE; ROOT (X, Y, Z, R1, R2, OK); if OK then PUT (R1, R2); else PUT (“No solution.”); end if; end QUADRATIC procedure ROOT ( A, B, C: in REAL; Root1, Root2 : out REAL; Result: in out BOOLEAN) is... D : REAL;... begin D := B**2-4.0*A*C; if Result and D < 0.0 then Result := FALSE; return; Root1 := (-B + sqrt(D)) / (2.0*A); Root2 := (-B - sqrt(D)) / (2.0*A); Result := TRUE; end ROOT

CoupTest Systems 18 Coupling Paths Example 2 global / nonlocal variable G... G :=... ; def (G)... P1... if G > 100 then use (G)... Q1... t := G**2+X; use(G)... Q2... G :=... ; def (G)... P2

CoupTest Systems 19 Coupling-based Test Criteria  Call Coupling: All call-sites are executed.  All-Coupling-Defs: A path is executed from each last def of X in A to a first use in B.  All-Coupling-Uses: A path is executed from each last def of X in A to every first use in B.  All-Coupling-Paths: All subpath sets are executed from each last def of X in A to every first use in B. (Loops are bypassed and executed at least once.)

CoupTest Systems 20 Coupling Criteria Example X = 5 X = 4 X = 3 B (X) B (int y) Z = y T = y print (y)

CoupTest Systems 21 Coupling Criteria Example X = 5 X = 4 X = 3 B (X) B (int y) Z = y T = y print (y) First Uses 11, 12 Last Defs 2, 3

CoupTest Systems 22 Coupling-based Criteria Subsumption All-coupling-paths All-coupling-uses All-coupling-defs Call Coupling

CoupTest Systems 23 Measuring Coupling-based Criteria  Instrumentation  Relies on Call Tree

CoupTest Systems 24 Instrumenting for Coverage Analysis P’ has all the functionality of P plus extra statements n Extra statements keep track of whether portions of the software have been executed n Counters are kept for calls, last definitions, and first uses P InstrumentorP’

CoupTest Systems 25 Call Tree A CD GCBFE B f1

CoupTest Systems 26 Call Tree Instrumentation A CD GCBFE B f1 int CTab [] = 0; (one element for each call-site.) CTab [3] ++; CTab [5] ++; CTab [4] ++; CTab [2] ++; CTab [1] ++; CTab [7] ++; CTab [6] ++;

CoupTest Systems 27 Call Tree Instrumentation n After testing, if CTab[i] is 0, that call-site has not been covered. n CTab[] must be saved to disk between executions. n CTab[] is used as a basis from which to generate a report.

CoupTest Systems 28 All-Coupling-Defs Instrumentation X = 5 X = 4 X = 3 B (X) B (int y) Z = y T = y print (y) LastDef [X] = 2; LastDef [X] = 3; CTab [LastDef [ y]] ++;

CoupTest Systems 29 All-Coupling-Defs Instrumentation X = 5 X = 4 X = 3 B (X) B (int y) Z = y T = y print (y) LastDef [X] = 2; LastDef [X] = 3; CTab [LastDef [ ActualOf [y]]] ++; ActualOf [y] = X;

CoupTest Systems 30 All-Coupling-Uses Instrumentation X = 5 X = 4 X = 3 B (X) B (int y) Z = y T = y print (y) LastDef [X] = 2; LastDef [X] = 3; CTab [12, LastDef [ ActualOf [y]]] ++; CTab [11, LastDef [ ActualOf [y]]] ++; ActualOf [y] = X;

CoupTest Systems 31 Measuring Coupling-based Criteria call - coupling = edges-covered edges coupling - use = def-use pairs covered def-use pairs coupling - path = coupling-paths covered coupling-paths coupling - def = coupling-defs covered coupling-defs

CoupTest Systems 32 Evaluation of Coupling-based Testing Category partition Coupling based Inter- procedural Test cases Faults found7118 Faults missed514

CoupTest Systems 33 Current Work n Coverage analysis tool (based on instrumentation) being developed n Empirical evaluation on larger programs ongoing n Object-oriented language features (inheritance and polymorphism): –Analysis techniques developed –Testing criteria defined –Coverage analysis tool under development n Metrics n Test data generation

CoupTest Systems 34 Coverage Analysis Tool Java Grammar JCCParser Java Tree Builder Java Program P AST Instrumentors Visitors A class for each node P call coupling P all-coupling defs P all-coupling uses P all-coupling subpaths

CoupTest Systems 35 Testing OO Programs n Assumption: (Re)testing will be easier. –Inheritance would eliminate much of the testing. n Reality: A lot more to test! –Complexity has moved to the connections. –Polymorphism introduces non-determinism.

CoupTest Systems 36 Overriding Methods n An overriding subclass needs to be tested. –Methods computing semantically close functions may require different tests (Antiextensionality axiom) n Reasons for new test cases –Different program texts –Possibly different behavior (a bad idea!!)

CoupTest Systems 37 Example

CoupTest Systems 38 Polymorphism Headaches (Yo-Yo) A +d () +g () +h () +i () +j () +l () Instantiated type B k() h()i() C j()i()l() A d()j()g()h()i()l() implicit Object is of type A A::d ()

CoupTest Systems 39 Polymorphism Headaches (Yo-Yo) A +d () +g () +h () +i () +j () +l () B +h () +i () +k () Instantiated type B h()i()k() implicit Instantiated type B k() h()i() C j()i()l() A d()j()g()h()i()l() C j()i()l() A d()j()g()h()i()l() implicit Object is of type B B::d ()

CoupTest Systems 40 Polymorphism Headaches (Yo-Yo) A +d () +g () +h () +i () +j () +l () B +h () +i () +k () C +i () +j () +l () Instantiated type C j()i()l() B h()i()k() implicit Instantiated type Instantiated type B k() h()i() C j()i()l() A d()j()g()h()i()l() C j()i()l() A d()j()g()h()i()l() B h()i() k() A d()j()g()h()i()l() implicit Object is of type C, C::d ()

CoupTest Systems 41 Conclusions  Test coverage criteria for integration testing  Coverage measurement can quantitatively measure testing results  Highly automatable  Satisfies USA’s Federal Aviation Administration requirements on structural coverage  Object-oriented software presents many interesting new twists  Many open problems  True software engineering: Technically challenging and practical

CoupTest Systems 42 Summary of Talk