1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.

Slides:



Advertisements
Similar presentations
Introduction to Object Orientation System Analysis and Design
Advertisements

OBJECT ORIENTED TESTING SYSTEM TESTING UNIT TESTING INTEGRATION TESTING INHERITANCE POLYMORPHISM ENCAPSULATION By Maj Nicko Petchiny.
Overview Structural Testing Introduction – General Concepts
OO Testing Problems Adequate Testing and OOP Perry/Kaiser.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
1 CIS601: Object-Oriented Programming in C++ Note: CIS 601 notes were originally developed by H. Zhu for NJIT DL Program. The notes were subsequently revised.
Object-Oriented Analysis and Design
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
Object-Oriented PHP (1)
Chess Review May 8, 2003 Berkeley, CA Classes and Inheritance in Actor- Oriented Models Stephen Neuendorffer Edward Lee UC Berkeley.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
16/22/2015 2:54 PM6/22/2015 2:54 PM6/22/2015 2:54 PMObject-Oriented Development Concept originated with simulating objects and their interactions. Adapted.
Criteria for good design. aim to appreciate the proper and improper uses of inheritance and appreciate the concepts of coupling and cohesion.
Systems Analysis & Design Sixth Edition Systems Analysis & Design Sixth Edition Toolkit Part 5.
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
Object Oriented Concepts. Movement toward Objects Instead of data-oriented or process-oriented Analysis, many firms are now moving to object-oriented.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
Chapter 13 & 14 Software Testing Strategies and Techniques
The Unified Modeling Language (UML) Class Diagrams.
Objects What are Objects Observations
Introduction To System Analysis and design
1 Object-Oriented Testing CIS 375 Bruce R. Maxim UM-Dearborn.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Object-Oriented Software Testing. C-S 5462 Object-Oriented Software Testing Research confirms that testing methods proposed for procedural approach are.
Overview Integration Testing Decomposition Based Integration
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
An Object-Oriented Approach to Programming Logic and Design
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Database Management System Prepared by Dr. Ahmed El-Ragal Reviewed & Presented By Mr. Mahmoud Rafeek Alfarra College Of Science & Technology Khan younis.
Ch6: Software Verification. 1 Decision table based testing  Applicability:  Spec. is described by a decision table.  Tables describe:  How combinations.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Chapter 13: Regression Testing Omar Meqdadi SE 3860 Lecture 13 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Systems Analysis & Design 7 th Edition Chapter 5.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
Testing Object-Oriented Software (an Overview) Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 12.
CIS 112 Exam Review. Exam Content 100 questions valued at 1 point each 100 questions valued at 1 point each 100 points total 100 points total 10 each.
Information System Design (IT60105) Lecture 26 Object-Oriented System Testing.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Software testing techniques Software testing techniques Object-oriented software testing Presentation on the seminar Kaunas University of Technology.
Object Oriented Programming
Systems Analysis and Design in a Changing World, Fourth Edition
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
Testing in OO Environment The reasons for testing is not any different for any of the design and implementation methodologies, including OO methodology.
OBJECT-ORIENTED TESTING. TESTING OOA AND OOD MODELS Analysis and design models cannot be tested in the conventional sense. However, formal technical reviews.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Regression Testing with its types
The Object-Oriented Thought Process Chapter 1
Chapter 13 & 14 Software Testing Strategies and Techniques
Section 11.1 Class Variables and Methods
Object-Oriented Programming
Chapter 20 Object-Oriented Analysis and Design
Chapter 10 – Software Testing
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis

2 Overview  Object Oriented Testing  General - Introduction  Unit Testing  Integration Testing  System Testing Ref: “Software Testing A Craftsman's Approach” 2nd edition, Paul C. Jorgensen

3 Testing of Object Oriented Programs General Notes Testing Implications Effects of: –Encapsulation –Method Overriding –Inheritance Hierarchical Incremental Class Testing –Base Class Testing

4 General Notes As with traditional development object-oriented development proceeds via structural, contextual, and behavioral models –Structural models focus on the encapsulation between actions and data or ports –Contextual models focus on port objects and boundaries of the system –Behavioral models focus on the states of an object in terms of the vents occurring However, Object Orientation poses new challenges into Testing

5 The Basic Constructs in OO Data Port Action Thread Event n n n n n n Object

6 Levels of Testing Classes as a subject of unit level object-oriented testing –Several methods in a class –Some methods can be large Methods are a better starting point for Unit Testing in object oriented systems System testing is generally unaffected by object orientation –MM Path as a sequence of method execution linked by messages –ASF is an input port event, followed by one or more MM-Paths and terminated with an output port event Messages not a decomposition tree as a driving force for Integration testing

7 Testing Adequacy A program is “adequately” tested if it has been covered according to some criteria. –Specification-based (i.e. black-box) Determine if program meets the functional and non-functional specifications. –Program-based (i.e. white box) Inspect program statements and select test cases to cover program. Basic approaches are orthogonal and complementary

8 Testing Implications Antiextensionality –Given two programs that compute the same function, then a test set that is adequate for one program is not necessarily adequate for the other. –From a specification-based testing point of view: Both programs have the same specification – hence a test adequate for one must be adequate for the other. But the implementations may be radically different - No guarantee that same coverage attained on both programs with same test set.

9 General Multiple Change –When two programs are syntactically similar (have same shape) they usually require different test sets. –“same shape” if one program can be transformed into the other applying following rules: Replace relational operator r1 in a predicate with relational operator r2. Replace constant c1 in assignment or predicate with constant c2. Replace arithmetic operator a1 in assignment statement with operator a2. –A test case to drive a branch in one program may not drive the same branch in the other. Testing Implications

10 Antidecomposition –A component’s test set may be adequate in the context of the enclosing program, but may not be adequate for other uses of that component. –An example may be that of unreachable code. Code that is unreachable within one context may in fact be reachable in another context. In specification-based testing, the enclosing program may not utilize all the functionality of the component. Testing Implications

11 Anticomposition –Adequate testing of individual components in isolation may not necessarily provide adequate testing for the entire program. –The composition of components may produce interaction errors not visible in isolation. –If components are sequential, then less powerful but still true. –Consider: a specification captures only what the program should do and behavior outside the scope of the specification may not be visible in one context, but cause errors in another context. Testing Implications

12 Testing Implications Encapsulation –If make change to implementation of a unit, then limit testing only to affected unit, users of the unit should be unaffected. –But consider now, anticomposition: The necessity to retest every dependent unit as well. Implication: integration testing is always necessary in addition to unit testing – regardless of program paradigm.

13 Fortunately, need only to retest the changed unit and only those which depend on it. The use of subclasses adds an unexpected form of dependency: –We expect that if a superclass is modified, then we must retest all subclasses because of their inheritance dependency. –From antidecomposition: if an new subclass is added or an old one modified, we must retest the methods inherited from each of its ancestor superclasses. Reason: provides a new context for the inherited methods. The dependency is actually in both directions. Testing Implications

14 –Exception: the new subclass is a pure extension of the superclass: Adds only new instance variables and new methods. There are no interactions with the new and old variables and methods.

15 Testing Implications Method Overriding The overriding subclass must be retested and due to antiextensionality, a different test is often needed. –From a program-based test approach, the same coverage might not be obtained with the original test set. –Often, the overriding method has not only a structural change but also different eternal behavior

16 Testing Implications Inheritance Consider the subclass definition as a modifier which defines attributes that differ from or alter the attributes in the parent class. The modifier + parent class + inheritance rules for the language define the subclass. The subclass designer specifies the modifier. Ref [Harrold]

17 Although M transforms the parent class P into the result class R it does not totally constrain R. We must take into account the inheritance relation which determines the effects of composing P and M into R. P Parent class M modifier  R resultant class The composition operator,  unites M and P to obtain the new class R, where R = P  M

18 The modifier approach allows a decomposition of the inheritance structure into overlapping sets of class inheritance relations. This decomposition allows the consideration of only the immediate parents and the modifier when testing a subclass. A B C A M1 M2   B C A M1  B B M2  C

19 The inheritance relation imposes an ordering on the classes: –Class C can be determined without considering class A –But the relation from A to B must be resolved prior to describing the relation from B to C. –This allows consideration of only a class and its immediate parents to fully constrain the definition of that class.

20 Hierarchical Incremental Class Testing A class testing technique that: –Initially test a base class by testing each member function individually. –Then test the interactions among member functions. Save test case design and execution information in a testing history.

21 When a subclass is defined: Testing history of parent, Definition of modifier, Inheritance mapping –Determine which attributes to (re)-test in the subclass and which test cases of parent can be reused.

22 Base Class Testing From antidecomposition: –Adequate testing of base class does not guarantee adequate of each member function. –Important to adequately test member function due to the inheritance by subclasses and operation in new contexts. –Individually test each member function using specification and program-based test cases. –Handle calls to other member functions using stubs.

23 From anticomposition: –Testing each member function individually does not imply that the class has been tested adequately. –Use intra-class testing: test interactions among member functions within the same class. –Develop both specification and program-based test suites. Inter-class testing: when member functions of one class interact with member functions in another class: –Member function in one class receives an instance of another class and sends that class a message. –An instance of class is part of representation of another class and then sends that instance as a message.

24 Testing Subclasses Actions dependent on the attribute type and the type of modifications due to the inheritance mapping: –New or virtual-new member function attribute A must be completely tested since it was not defined in P. Integration test A with other members of R with which it interacts. –Recursive or virtual-recursive member function attribute A needs limited retesting since it was previously tested in P. Its specification and implementation remain unchanged. –Refined or virtual-refined attribute A in M needs extensive retesting. Many of the existing specification-based tests can be reused since only implementation has changed.

25 Use data flow testing to validate the interfaces between procedures. –Focus: the definitions and uses of variables that extend across procedure boundaries (include global variables and reference parameters). –Validate class member functions individually and test interface among member functions. –Use stubs/drivers to represent incomplete implementations.

26 References 1.D.E. Perry and G.E. Kaiser: Adequate Testing and Object-Oriented Programming, Journal of Object-Oriented Programming, Jan. 1990, pp M.J. Harrold, J.D. McGregor and K.J. Fitzpatrick: Incremental Testing of Object- Oriented Class Structures, Proceedings of 14 th Int’l Software Eng., 1992, pp