5/7/03ICSE 20031 Fragment Class Analysis for Testing of Polymorphism in Java Software Atanas (Nasko) Rountev Ohio State University Ana Milanova Barbara.

Slides:



Advertisements
Similar presentations
ASSUMPTION HIERARCHY FOR A CHA CALL GRAPH CONSTRUCTION ALGORITHM JASON SAWIN & ATANAS ROUNTEV.
Advertisements

Effective Static Deadlock Detection
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
Graph Coverage for Design Elements 1.  Use of data abstraction and object oriented software has increased importance on modularity and reuse.  Therefore.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
1 Practical Object-sensitive Points-to Analysis for Java Ana Milanova Atanas Rountev Barbara Ryder Rutgers University.
Parameterized Object Sensitivity for Points-to Analysis for Java Presented By: - Anand Bahety Dan Bucatanschi.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Review Amit Shabtay. March 3rd, 2004 Object Oriented Design Course 2 Review What have we done during the course? Where to learn more? What is for the.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Discrete-Event Simulation: A First Course Steve Park and Larry Leemis College of William and Mary.
Scaling CFL-Reachability-Based Points- To Analysis Using Context-Sensitive Must-Not-Alias Analysis Guoqing Xu, Atanas Rountev, Manu Sridharan Ohio State.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas.
Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas.
An Efficient Inclusion-Based Points-To Analysis for Strictly-Typed Languages John Whaley Monica S. Lam Computer Systems Laboratory Stanford University.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University STATIC ANALYSES FOR JAVA IN THE PRESENCE OF DISTRIBUTED COMPONENTS AND.
PRESTO Research Group, Ohio State University Interprocedural Dataflow Analysis in the Presence of Large Libraries Atanas (Nasko) Rountev Scott Kagan Ohio.
Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt
Understanding Parallelism-Inhibiting Dependences in Sequential Java Programs Atanas (Nasko) Rountev Kevin Van Valkenburgh Dacong Yan P. Sadayappan Ohio.
Programming With Java ICS201 University Of Ha’il1 Chapter 8 Polymorphism and Abstract Classes.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Coverage Criteria for Testing of Object Interactions in Sequence Diagrams Atanas (Nasko) Rountev Scott Kagan Jason Sawin Ohio State University.
Type Systems CS Definitions Program analysis Discovering facts about programs. Dynamic analysis Program analysis by using program executions.
SNPL1 Woochang Lim What (Variable) + How (Function) = Object Objects are the physical and conceptual things we find in the universe around us. Object-Oriented.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Information System Design (IT60105) Lecture 26 Object-Oriented System Testing.
DEVS Based Modeling and Simulation of the CORBA POA F. Bernardi, E. de Gentili, Pr. J.F. Santucci {bernardi, gentili, University.
CBSE'051 Component-Level Dataflow Analysis Atanas (Nasko) Rountev Ohio State University.
Introduction to Software Testing (2nd edition) Chapter 7.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt
ESEC/FSE-99 1 Data-Flow Analysis of Program Fragments Atanas Rountev 1 Barbara G. Ryder 1 William Landi 2 1 Department of Computer Science, Rutgers University.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Testing Inheritance & Polymorphism in OO Software using Formal Specification Presented by : Mahreen Aziz Ahmad (Center for Software Dependability, MAJU)
程建群 博士 (Dr. Jason Cheng) 年 03 月 Software Engineering Part 08.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Polymorphism, Virtual Methods and Interfaces Version 1.1.
CS 343 presentation Concrete Type Inference Department of Computer Science Stanford University.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
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.
Pointer Analysis – Part I CS Pointer Analysis Answers which pointers can point to which memory locations at run-time Central to many program optimization.
Sept 12ICSM'041 Precise Identification of Side-Effect-Free Methods in Java Atanas (Nasko) Rountev Ohio State University.
Whole Test Suite Generation. Abstract Not all bugs lead to program crashes, and not always is there a formal specification to check the correctness of.
Object Naming Analysis for Reverse- Engineered Sequence Diagrams Atanas (Nasko) Rountev Beth Harkness Connell Ohio State University.
1PLDI 2000 Off-line Variable Substitution for Scaling Points-to Analysis Atanas (Nasko) Rountev PROLANGS Group Rutgers University Satish Chandra Bell Labs.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
CSCI-383 Object-Oriented Programming & Design Lecture 17.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Csontos Péter, Porkoláb Zoltán Eötvös Loránd Tudományegyetem, Budapest ECOOP 2001 On the complexity of exception handling.
Inheritance a subclass extends the functionality of a superclass a subclass inherits all the functionality of a superclass don't reinvent the wheel – "stand.
Static Analysis of Object References in RMI-based Java Software
Testing Tutorial 7.
Generating Automated Tests from Behavior Models
Inheritance and Polymorphism
Atanas (Nasko) Rountev Barbara G. Ryder Rutgers University
Building a Whole-Program Type Analysis in Eclipse
Points-to Analysis for Java Using Annotated Constraints
Graph Coverage for Design Elements CS 4501 / 6501 Software Testing
Paul Ammann & Jeff Offutt
Demand-Driven Context-Sensitive Alias Analysis for Java
Graph Coverage for Design Elements CS 4501 / 6501 Software Testing
Introduction to Data Structure
Interactive Exploration of Reverse-Engineered UML Sequence Diagrams
C. M. Overstreet Old Dominion University Fall 2005
Presentation transcript:

5/7/03ICSE Fragment Class Analysis for Testing of Polymorphism in Java Software Atanas (Nasko) Rountev Ohio State University Ana Milanova Barbara Ryder Rutgers University

5/7/03ICSE Testing of Polymorphism  Testing of object-oriented software  Inheritance, polymorphism, object state, etc.  Polymorphism  A variable may refer to objects of different classes  Existing work on testing of polymorphism  Basic idea: exercise all possible polymorphic bindings  Our focus: bindings at polymorphic calls

5/7/03ICSE Two Coverage Criteria for Calls  RC criterion: exercise each call site with all possible classes of the receiver object  At x.m(), x may refer to A, B, or C objects  TM criterion: exercise each call site with all possible target methods  x.m() may invoke A.m or C.m  Goal: build a tool for Java that measures RC/TM coverage achieved by test suites  The approach is also applicable to other criteria for testing of polymorphism

5/7/03ICSE Coverage Tool for Testing of Polymorphism  Step 1: analyze the tested code  What are all possible receiver classes and target methods at polymorphic call sites?  Need class analysis  Step 2: insert instrumentation  Step 3: run tests and report coverage  What were the receiver classes and target methods actually observed while running the tests? compare

5/7/03ICSE Outline  Class analysis  Class analysis of partial programs  Contribution 1: General approach that enables existing analyses to handle partial programs  Analysis imprecision  Experimental results  Contribution 2: Determining the imprecision of four popular class analyses  Conclusions and future work

5/7/03ICSE Class Analysis  Essential static analysis for object-oriented languages; large body of existing work  Given a reference variable x, what kinds of objects may x refer to?  e.g. “x may refer to instances of A, B, or C”  Uses of class analysis  Compiler optimizations: e.g. devirtualization  Software understanding and restructuring  Testing: e.g. to compute the RC/TM criteria

5/7/03ICSE Problem 1: Partial Programs  Many existing class analyses  Typically defined as whole-program analyses  Cannot be used directly when testing is done on partial programs  Analysis input  Component under test (CUT): set of classes  CUT interface that is being tested  Methods and fields against which tests have been written  Server classes of CUT classes

5/7/03ICSE Fragment Class Analysis  Goal: adapt whole-program class analyses  Solution: fragment class analysis  Step 1: Create additional code that “simulates” the possible effects of unknown external code  Located inside an artificial main  Step 2: Run a whole-program class analysis starting from main  Use the resulting solution to determine RC and TM at polymorphic call sites in the CUT

5/7/03ICSE Analysis Solution  If it is possible to write a test that executes x.m() with a receiver of class Y, the analysis solution must report Y  Need to “simulate” all possible (infinitely many) tests for the component  This property provably holds for a large category of whole-program class analyses  Flow insensitive  Context insensitive and context sensitive

5/7/03ICSE Placeholder Variables  main contains placeholders for all reference variables from unknown external code class A { public A() {...} public Y m(Z z) {...} } class B extends A { public B m2(A a) {…} } Placeholder variables main() { A ph_a; B ph_b; Y ph_y; Z ph_z; … } CUT

5/7/03ICSE Placeholder Statements class A { public A() {...} public Y m(Z z) {...} } class B extends A { public B m2(A a) {…} } Placeholder statements main() { … ph_a = new A(); ph_y = ph_a.m(ph_z); ph_b = ph_b.m2(ph_a); … ph_a = ph_b; ph_b = (B) ph_a; … }

5/7/03ICSE Placeholder Statements class A { public A() {...} public Y m(Z z) {...} } class B extends A { public B m2(A a) {…} } Placeholder statements main() { … ph_a = new A(); ph_y = ph_a.m(ph_z); ph_b = ph_b.m2(ph_a); … ph_a = ph_b; ph_b = (B) ph_a; … }

5/7/03ICSE Placeholder Statements class A { public A() {...} public Y m(Z z) {...} } class B extends A { public B m2(A a) {…} } Placeholder statements main() { … ph_a = new A(); ph_y = ph_a.m(ph_z); ph_b = ph_b.m2(ph_a); … ph_a = ph_b; ph_b = (B) ph_a; … }

5/7/03ICSE Problem 2: Analysis Imprecision  Among all classes reported by the analysis, which ones are impossible at run time?  Coverage requirements that cannot be satisfied  Goal: determine the imprecision of four fragment class analyses, derived from:  Class Hierarchy Analysis (CHA)  Rapid Type Analysis (RTA)  0-CFA  Andersen’s points-to analysis (AND)  No such data is available in previous work

5/7/03ICSE Experiments  Considered 8 CUTs  From publicly available Java libraries  CUT size: between 8 and 24 classes  Wrote tests that achieve as much RC/TM coverage as possible  Two people wrote tests independently  Compared differences and merged  Metric of imprecision: coverage reported by the tool for these tests  Report of 100% means no analysis imprecision

5/7/03ICSE RC Coverage

5/7/03ICSE Results  Bad news: CHA and RTA have significant imprecision and should be avoided  Good news: 0-CFA and AND have much lower imprecision  Close to 100% for 5 of the 8 components  Good candidates for future investigations  Open questions  Will we see the same trend for other CUTs?  What is the improvement for analyses that are theoretically more precise than 0-CFA and AND?

5/7/03ICSE Future Work  More datapoints  More class analyses (e.g. context-sensitive)  When do analyses fail?  Common sources of imprecision  Generalize to flow-sensitive analyses  Apply to existing test suites  Measure achieved coverage  Identify weaknesses and add more test cases