1 Testing Object-Oriented Software A Presentation at a DFW ASEE Meeting Dr. David C. Kung The University of Texas at Arlington and Advanced Software International.

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Object-Oriented Software Engineering Visual OO Analysis and Design
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
10 Software Engineering Foundations of Computer Science ã Cengage Learning.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
Systems Analysis and Design 8th Edition
Software testing.
Object-Oriented Analysis and Design
Department of Computing
Introduction To System Analysis and Design
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
1 Postdelivery Maintenance Xiaojun Qi. 2 Why Postdelivery Maintenance Is Necessary Corrective maintenance: To correct residual faults –Analysis, design,
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
©Ian Sommerville 2006Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Systems Analysis & Design Sixth Edition Systems Analysis & Design Sixth Edition Toolkit Part 5.
© Copyright Eliyahu Brutman Programming Techniques Course.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
- Testing programs to establish the presence of system defects -
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Software Testing & Strategies
Comp 587 Parker Li Bobby Kolski. Automated testing tools assist software engineers to gauge the quality of software by automating the mechanical aspects.
Chapter 13 & 14 Software Testing Strategies and Techniques
Introduction To System Analysis and design
Systems Analysis – Analyzing Requirements.  Analyzing requirement stage identifies user information needs and new systems requirements  IS dev team.
1 Object-Oriented Testing CIS 375 Bruce R. Maxim UM-Dearborn.
Object-Oriented Software Testing. C-S 5462 Object-Oriented Software Testing Research confirms that testing methods proposed for procedural approach are.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
TESTING.
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
1 Quality Center 10.0 NOTE: Uninstall the current version of QC before downloading QC All QC 10.0 documents can be located on the BI Shared Services.
Unified Modeling Language, Version 2.0
1 On to Object Design Chapter 14 Applying UML and Patterns.
Software Testing Testing types Testing strategy Testing principles.
1 Software Defect Testing Testing programs to establish the presence of system defects.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Concepts of Software Quality Yonglei Tao 1. Software Quality Attributes  Reliability  correctness, completeness, consistency, robustness  Testability.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
Systems Analysis & Design 7 th Edition Chapter 5.
To navigate the slide presentation, use the navigation bar on the left OR use your right and left arrow keys. Move your mouse over the key terms throughout.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML.
Systems Analysis and Design 8 th Edition Chapter 6 Object Modeling.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
UML Use Case Diagramming Guidelines. What is UML? The Unified Modeling Language (UML) is a standard language for specifying, visualizing, constructing,
Lecture 1: Introduction to Software Engineering WXGE6103 Software Engineering Process and Practice Object-oriented Design.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
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:
Generating Software Documentation in Use Case Maps from Filtered Execution Traces Edna Braun, Daniel Amyot, Timothy Lethbridge University of Ottawa, Canada.
Chapter 8 Testing. Principles of Object-Oriented Testing Å Object-oriented systems are built out of two or more interrelated objects Å Determining the.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Winter 2011SEG Chapter 11 Chapter 1 (Part 1) Review from previous courses Subject 1: The Software Development Process.
CS451 Lecture 10: Software Testing Yugi Lee STB #555 (816)
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation.
Testing in OO Environment The reasons for testing is not any different for any of the design and implementation methodologies, including OO methodology.
© 2009 Artisan Software Tools. All rights reserved. Testing Solutions with UML/SysML Andrew Stuart, Matthew Hause.
Defect testing Testing programs to establish the presence of system defects.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Object-Oriented Analysis and Design
Unified Modeling Language
Chapter 13 & 14 Software Testing Strategies and Techniques
Business System Development
Chapter 10 – Software Testing
Chapter 5.
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

1 Testing Object-Oriented Software A Presentation at a DFW ASEE Meeting Dr. David C. Kung The University of Texas at Arlington and Advanced Software International Corporation Arlington, Texas

2 Overview of Presentation Why Object-Oriented Software Testing The State-of-the-Research OO Software Testing Research at UTA OOTWorks Software Demonstration

3 Why Object-Oriented Software Testing transition to OO development is not easy –OO conceptualization, design and programming significantly impact the quality –many developers’ mindset is still in procedural design and programming –anti-design patterns are commonly found in OO design and OO code

4 Case Study 1: Analysis of a Fedex Ship Manager Software This software was designed and implemented by a team of students taking an OO software engineering class It has nothing to do with Fedex The software was supposed to compute and display the shipment charges for all Fedex services from a given origin zip to a given destination zip This program is working but it has some design problems We show how OOTWorks can be used to detect these design problems

5 Poor Conceptualization NextAfternoon, OvernightExpress, Ground, etc. are services. They are not a RateChart. It is better to use association.

6 Poor Responsibility Assignment There should not be a class called “RateCalculator”. The services are the “experts” who know how to calculate their own rates. This design assigns the responsibility to the wrong object.

7 Incorrect Use of Inheritance Child classes must not repeat the same code as the parent class, failing to utilize the inheritance and polymorphism features. This increases the maintenance effort.

8 Better Design Better conceptualization. The services use ZoneChart and Delivery Area Surcharge to calculate rates.

9 Better Design The subclasses inherit and use all of the methods of the superclass.

10 Automatic Design Improvement The repeated code can be deleted from the subclasses.

11 Automatic Design Improvement

12 Why Object-Oriented Software Testing OO features introduce new testing problems –encapsulation leading to long method invocation chains, more difficulty to understand the (overall) functionality –inheritance and polymorphism: which method to execute is determined at run time –multiple and/or repeated inheritance may cause incorrect interaction in child classes –you cannot test a class, you can only test instances of a class

13 Invocation chains in the InterViews Library: 122 classes, >400 relationships Chain Length Number of Chains

14 Why Object-Oriented Software Testing main () { Shape *p; …. p->print(); // which print() to // execute? … } Shape print () Box print () Square print ()

15 objects engage in complex interdependent relationships –testing one object may require test stubs to simulate other objects –test stubs construction is costly and time consuming –mutual or cyclic dependencies introduce additional complexity and costs in unit and integration testing –need a test order for unit testing and integration testing Why Object-Oriented Software Testing

16 Complex Relationships

17 objects exhibit strong state dependent behaviors –how to identify states and transitions? –how to identify state dependent interactions? –how to generate test cases to test state behaviors? –how to reduce the complexity of state behavior testing? Why Object-Oriented Software Testing

18 The State-of-the-Research OO software testing began in the 1990s A number of test methods and techniques have been proposed There are various tools, some are free some are not The tester still has to do a lot of work

19 The State-of-the-Research OO Test Methods and Techniques –incremental testing of class hierarchy –test order –object state testing –class testing, cluster testing –data flow analysis –testing polymorphic relationships –data flow analysis for exception handling mechanism –OO regression testing

20 OO Software Testing Research at UTA A reverse engineering technology Plus a set of utilities to facilitate program understanding design documentation design analysis design improvement metrics calculation test scheduling change impact analysis version comparison test case generation test data generation design improvement code review & analysis code improvement test execution result analysis and more... The result is the OOTWorks toolkit

21 Why OOTWorks It improves productivity and quality in –Documentation –Design and code reviews –Testing, regression testing and maintenance –Test planning and scheduling It reduces the time and effort required to prepare for CMM/ audit each year

22 The OOTWorks Modules ORD (Object Relation Diagram) BBD (Block Bench Diagram) OSD (Object State Diagram)(Package Relation Diagram) PRD OID (Object Interaction Diagram)

23 Object Relation Diagram (ORD) Visualization of –Classes, relationships, data members, function members, and source code, selectable by the user –Test order for unit and integration testing –Change impact and version comparison Computation of various OO metrics Useful for –program comprehension and assessment –documentation –design and code review –test scheduling and effort estimation

24 An Object Relation Diagram

25 Object Relation Diagram (ORD) Generation of a cost-effective schedule –for implementing the classes (required code skeleton) –for changing the classes –for code review of the classes –for testing the classes –it effectively reduces time, effort and costs to accomplish above tasks

26 Generation of Cost-Effective Test Order Classes with test order 1:0 should be tested before classes with test order 2:0 to reduce the test effort.

27 Test Stubs Required for Randomly Selected Test Sequences

28 Saving from Test Order Average one person-hour is required to construct a test stub. For the InterViews library, person-hours, or close to 5 person-weeks are required. Using test order, only one test stub is needed, the saving in effort and costs are tremendous even for this small program.

29 Generation of Test Schedule Critical path Testing of classes on the critical path must be completed on time to ensure that the test process will be completed on time.

30 Object Relation Diagram (ORD) Computation of various OO metrics –Fan-in and fan out –Depth of inheritance tree –Number of lines of code –Length of invocation chain –Cyclomatic complexity –Number of children, etc. Useful for assessing program quality and spot potential problem areas

31 Various OO Metrics

32 Object Relation Diagram (ORD) Change impact analysis and visualization –Compare change alternatives Version comparison and visualization –Compare two versions/releases to identify changes and their impact –Visualizing the two versions/releases to facilitate code review and inspection to ensure that changes are made properly –Useful for maintenance, release review and regression testing to reduce time, effort and costs

33 Change and Impact Analysis

34 Block Branch Diagram (BBD)

35 Block Branch Diagram (BBD) for test input preparation for test case preparation for test stub preparation

36 An Overly Complex Method Is Difficulty to Comprehend and Test

37 Block Branch Diagram Useful for white-box testing (basis path, data flow) Useful for state transition construction Useful for black-box testing –Boundary value analysis –Functional testing Initialize parameters Initialize input values Identify and construct test stubs Analysis of test results (changed variables) Used for sequence diagram reverse engineering

38 Object State Diagram Hierarchical, concurrent, communicating state machines Generated from C++/Java source code using a reverse engineering approach Represents the dynamic state dependent behavior of objects

39 allowVend: unsigned 0,0 1,M CoinBox() Reset() Vend() AddQtr() [curQtrs > 0] AddQtr() ReturnQtrs() [allowVend !=0] Vend() S0S1 S0 S1 curQtrs: unsigned An Object State Diagram for an incorrect coin box class

40 (S0, S0) (S1, S1) (S0, S1) (S1, S1) (S1, S0) Reset(), ReturnQtr() ReturnQtr() AddQtr() Reset() (S0, S0)(S1, S0) ReturnQtr()Reset() AddQtr() Vend() Test tree showing the execution sequences of a COSD

41 off, off, off heat,off,offcool,off,off off, off, off SS, FR, AR SS.heat SS.cool heat, on, offoff, off, off off, on, off off, off, off cool, on, off heat, on, off off, on, offcool, on, on SS.off FR.turnOnSS.off SS.heat SS.cool FR.turnOff SS.off AR.turnOn SS: Season Switch FR: Furnace Relay AR: A/C Relay Test tree showing a flaw in a thermostat system.

42 Sequence Diagram A sequence diagram describes the object interaction through time ordered message passing. Elements and their Notations –Objects Placed at top of the diagram across the horizontal axis –Lifelines Dotted lines extending down the vertical axis –Messages and Stimulus Horizontal solid labeled arrow. –Focus of Control Tall thin rectangle along the vertical axis.

43 Sequence Diagram Example

44 Sequence Diagram Showing a Use Case

45 Usefulness of Sequence Diagram Understanding how use cases are implemented Automatic generation of test cases and test data to test the implementation Facilitating design and code review Check if some behavioral design patterns are propertly implemented

46 Some Application Data OOTWorks can process millions of lines of source code and thousands of classes Parsing of a 50,000 line C++ files finishes in 20 seconds Platform independent (Windows, Linux, Unix,Soloaris, Mac, etc.) Display and print very large ORD diagrams Has been applied to real world applications with satisfactory results

47 Some Example Applications –Identification of isolated classes –Identification of possibly poorly designed OO software no use of inheritance and/or aggregation only one parent class, all the other classes are direct children of the parent class classes with several thousand lines of code classes with very high fan-in and/or fan-out metrics high cyclomatic complexity classes having excessive number of methods may indicate poor cohesion (or too much responsibilities) etc.

48 ORD BBD selected class & method Functional Tests Generation Structural Tests Generation Tests Tests Execution Result Analysis Tester using variables used and changed using basis paths & symbolic execution interactive testing batch testing Possible Test Process

49 ORD OSD selected classes Method Sequence Tests Generation Fault Analysis Tests Tests Execution Result Analysis Tester analysis results Possible Test Process

50 Develope r Tester SQA Project Manager time, effort and cost control productivity and quality improvement test scheduling program understanding documentation verification change impact analysis metrics test order program understanding test cases and test data preparation regression test metrics Maintenance version comparison change impact analysis regression test verification design and code review metrics documentation Summary