OMEN: A Strategy for Testing Object-Oriented Software

Slides:



Advertisements
Similar presentations
Chapter 22 Implementing lists: linked implementations.
Advertisements

Stacks, Queues, and Linked Lists
Linear Lists – Linked List Representation
Containers CMPS Reusable containers Simple data structures in almost all nontrivial programs Examples: vectors, linked lists, stacks, queues, binary.
Register Allocation Mooly Sagiv Schrierber Wed 10:00-12:00 html://
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Object-oriented Software Change Dynamic Impact Analysis Lulu Huang and Yeong-Tae Song Dept. of Computer and Information Sciences Towson University Towson,
Graph Coverage for Design Elements 1.  Use of data abstraction and object oriented software has increased importance on modularity and reuse.  Therefore.
A Regression Test Selection Technique for Aspect- Oriented Programs Guoqing Xu The Ohio State University
Elementary Data Structures CS 110: Data Structures and Algorithms First Semester,
Stacks. What is a stack? Last-in first-out data structure (LIFO) New objects are placed on top Removal restricted to top object Examples?
Stacks CS-240 Dick Steflik. Stacks Last In, First Out operation - LIFO As items are added they are chronologically ordered, items are removed in reverse.
Queues. What is a queue? First-in first-out data structure (FIFO) New objects are placed at rear Removal restricted to front Examples?
Stacks.
Queues.
Circular List Next field in the last node contains a pointer back to the first node rather than null pointer From any point in such a list it is possible.
Abstract data types & object-oriented paradigm. Abstraction Abstraction: a view of an entity that includes only the attributes of significance in a particular.
 By Wayne Cheng.  Introduction  Five Tenets  Terminology  The foundation of C++: Classes.
Chapter 7 Stacks II CS Data Structures I COSC 2006
Implementing Stacks Ellen Walker CPSC 201 Data Structures Hiram College.
Lecture Objectives To understand how Java implements a stack To learn how to implement a stack using an underlying array or linked list Implement a simple.
Review 1 Introduction Representation of Linear Array In Memory Operations on linear Arrays Traverse Insert Delete Example.
Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Data Structures. The Stack: Definition A stack is an ordered collection of items into which new items may be inserted and from which items may be deleted.
Software Testing and Maintenance Lecture 4 Graph Coverage for Design Element Paul Ammann & Jeff Offutt Instructor: Hossein Momeni Mazandaran.
CSC 212 Stacks & Queues. Announcement Many programs not compiled before submission  Several could not be compiled  Several others not tested with javadoc.
© 2004 Goodrich, Tamassia Stacks. © 2004 Goodrich, Tamassia Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data.
1 Graph Coverage (4). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
Introduction to Software Testing (2nd edition) Chapter 7.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Copyright © Curt Hill Stacks An Useful Abstract Data Type.
Lecture Objectives  To understand how Java implements a stack  To learn how to implement a stack using an underlying array or linked list  Implement.
CSCE 3110 Data Structures & Algorithm Analysis
Paul Ammann & Jeff Offutt
Stacks II David Lillis School of Computer Science and Informatics
CHAPTER 4: Linked Structures
Testing Object-Oriented Software Test Coverage Criteria
Revised based on textbook author’s notes.
Queues Rem Collier Room A1.02
Compositional Pointer and Escape Analysis for Java Programs
CSE 143 Linked Lists [Chapter , 8.8] 3/30/98.
Stacks.
Stack and Queue APURBO DATTA.
Stacks Chapter 4.
Graph Coverage for Design Elements CS 4501 / 6501 Software Testing
CS212: Object Oriented Analysis and Design
CSCE 3110 Data Structures & Algorithm Analysis
COMPUTER 2430 Object Oriented Programming and Data Structures I
Stacks and Queues.
Stack ADT & Modularity 2 implementations of the Stack abstract data type: Array Linked List Program design: modularity, abstraction and information hiding.
CSCE 3110 Data Structures & Algorithm Analysis
Stacks.
STACK By:- Rajendra ShakyawalP.G.T. Computer Science KV-No.1, AFS, Tambaram, Chennai.
5.4 Additional Stack Applications
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Linked List (Part I) Data structure.
Chapter 8: Data Abstractions
Programming paradigms
ADT list.
Graph Coverage for Design Elements CS 4501 / 6501 Software Testing
COMPUTER 2430 Object Oriented Programming and Data Structures I
Queues Jyh-Shing Roger Jang (張智星)
UNIT-II.
Stacks CS-240 Dick Steflik.
Standard Template Library
Abstract Data Types Stacks CSCI 240
5.3 Implementing a Stack Chapter 5 – The Stack.
COMPUTER 2430 Object Oriented Programming and Data Structures I
Presentation transcript:

OMEN: A Strategy for Testing Object-Oriented Software Amie L. Souter & Lori L. Pollock ISSTA 2000 Dept. of Computer and Information Sciences

Object-Oriented Programming Features Classes, Objects, and Inheritance Polymorphism and Dynamic Binding Programming Style Modularity: many small methods Objects Code reuse through inheritance Complex class interactions Heavy use of libraries

Illustrating Kinds of DEF-USE Pairs Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; 2 top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ 5 if(size() == 0) return error; 6 int temp = myStack[top-1]; 7 top--; 8 return temp; } 9 public int size() { return top; } 10 public int top() { return myStack[top-1]; } 11 public boolean isEmpty() { return top == 0; } 12 public void example() { push(10); if(size() == 5) do_something++; } intra-method traditional du analysis Weyuker:85

Illustrating Kinds of DEF-USE Pairs Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; 2 top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ 5 if(size() == 0) return error; 6 int temp = myStack[top-1]; 7 top--; 8 return temp; } 9 public int size() { return top; } 10 public int top() { return myStack[top-1]; } 11 public boolean isEmpty() { return top == 0; } 12 public void example() { push(10); if(size() == 5) do_something++; } intra-method traditional du analysis Weyuker:85

Illustrating Kinds of DEF-USE Pairs Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; 2 top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ 5 if(size() == 0) return error; 6 int temp = myStack[top-1]; 7 top--; 8 return temp; } 9 public int size() { return top; } 10 public int top() { return myStack[top-1]; } 11 public boolean isEmpty() { return top == 0; } 12 public void example() { push(10); if(size() == 5) do_something++; } inter-method interprocedural du analysis Harrold:89

Illustrating Kinds of DEF-USE Pairs Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; 2 top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ 5 if(size() == 0) return error; 6 int temp = myStack[top-1]; 7 top--; 8 return temp; } 9 public int size() { return top; } 10 public int top() { return myStack[top-1]; } 11 public boolean isEmpty() { return top == 0; } 12 public void example() { push(10); if(size() == 5) do_something++; } inter-method interprocedural du analysis Harrold:89

Illustrating Kinds of DEF-USE Pairs Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; 2 top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ 5 if(size() == 0) return error; 6 int temp = myStack[top-1]; 7 top--; 8 return temp; } 9 public int size() { return top; } 10 public int top() { return myStack[top-1]; } 11 public boolean isEmpty() { return top == 0; } 12 public void example() { push(10); if(size() == 5) do_something++; } inter-method interprocedural du analysis Harrold:89

Illustrating Kinds of DEF-USE Pairs Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; 2 top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ 5 if(size() == 0) return error; 6 int temp = myStack[top-1]; 7 top--; 8 return temp; } 9 public int size() { return top; } 10 public int top() { return myStack[top-1]; } 11 public boolean isEmpty() { return top == 0; } 12 public void example() { push(10); if(size() == 5) do_something++; } intra-class Intra-class du analysis Harrold & Rothermel: 94

Illustrating Kinds of DEF-USE Pairs Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; 2 top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ 5 if(size() == 0) return error; 6 int temp = myStack[top-1]; 7 top--; 8 return temp; } 9 public int size() { return top; } 10 public int top() { return myStack[top-1]; } 11 public boolean isEmpty() { return top == 0; } 12 public void example() { push(10); if(size() == 5) do_something++; } intra-class Intra-class du analysis Harrold & Rothermel: 94

Illustrating Kinds of DEF-USE Pairs Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; 2 top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ 5 if(size() == 0) return error; 6 int temp = myStack[top-1]; 7 top--; 8 return temp; } 9 public int size() { return top; } 10 public int top() { return myStack[top-1]; } 11 public boolean isEmpty() { return top == 0; } 12 public void example() { push(10); if(size() == 5) do_something++; } intra-class Intra-class du analysis Harrold & Rothermel: 94

DEF-USE Pairs Involving Inter-Class Interactions Class genericStack{ Array myStack; 1 public genericStack() { myStack = new Array(); } 2 public Object top() { return myStack.back(); } 3 public void push(Obj o){ myStack.pushBack(o); } 4 public Object pop() { return myStack.popBack(); } 5 public bool isEmpty() { return myStack.isEmpty(); } 6 public int size() { return myStack.size(); } } Class Array { Object myStorage[]; int myLength; 1 public Array() { myStorage = new Object[SIZE]; 2 myLength = 0; } 3 public Object back() { return myStorage[myLength-1];} 4 public Object popBack() { return myStorage[--myLength];} 5 public void pushBack(Obj o){ add(o); } 6 public Object front(Obj o) { return myStorage[0]; } 7 public bool isEmpty() { return (myLength == 0) } 8 public int size() { return myLength; } 9 public void add(Obj o){ myStorage[myLength++] = o; } //Array has 46 other methods } Inter-class du analysis Souter & Pollock:99

DEF-USE Pairs Involving Inter-Class Interactions Class genericStack{ Array myStack; 1 public genericStack() { myStack = new Array(); } 2 public Object top() { return myStack.back(); } 3 public void push(Obj o){ myStack.pushBack(o); } 4 public Object pop() { return myStack.popBack(); } 5 public bool isEmpty() { return myStack.isEmpty(); } 6 public int size() { return myStack.size(); } } Class Array { Object myStorage[]; int myLength; 1 public Array() { myStorage = new Object[SIZE]; 2 myLength = 0; } 3 public Object back() { return myStorage[myLength-1];} 4 public Object popBack() { return myStorage[--myLength];} 5 public void pushBack(Obj o){ add(o); } 6 public Object front(Obj o) { return myStorage[0]; } 7 public bool isEmpty() { return (myLength == 0) } 8 public int size() { return myLength; } 9 public void add(Obj o){ myStorage[myLength++] = o; } //Array has 46 other methods } Inter-class du analysis Souter & Pollock:99

DEF-USE Pairs Involving Inter-Class Interactions Class genericStack{ Array myStack; 1 public genericStack() { myStack = new Array(); } 2 public Object top() { return myStack.back(); } 3 public void push(Obj o){ myStack.pushBack(o); } 4 public Object pop() { return myStack.popBack(); } 5 public bool isEmpty() { return myStack.isEmpty(); } 6 public int size() { return myStack.size(); } } Class Array { Object myStorage[]; int myLength; 1 public Array() { myStorage = new Object[SIZE]; 2 myLength = 0; } 3 public Object back() { return myStorage[myLength-1];} 4 public Object popBack() { return myStorage[--myLength];} 5 public void pushBack(Obj o){ add(o); } 6 public Object front(Obj o) { return myStorage[0]; } 7 public bool isEmpty() { return (myLength == 0) } 8 public int size() { return myLength; } 9 public void add(Obj o){ myStorage[myLength++] = o; } //Array has 46 other methods } Inter-class du analysis Souter & Pollock:99

DEF-USE Pairs Involving Inter-Class Interactions Class genericStack{ Array myStack; 1 public genericStack() { myStack = new Array(); } 2 public Object top() { return myStack.back(); } 3 public void push(Obj o){ myStack.pushBack(o); } 4 public Object pop() { return myStack.popBack(); } 5 public bool isEmpty() { return myStack.isEmpty(); } 6 public int size() { return myStack.size(); } } Class Array { Object myStorage[]; int myLength; 1 public Array() { myStorage = new Object[SIZE]; 2 myLength = 0; } 3 public Object back() { return myStorage[myLength-1];} 4 public Object popBack() { return myStorage[--myLength];} 5 public void pushBack(Obj o){ add(o); } 6 public Object front(Obj o) { return myStorage[0]; } 7 public bool isEmpty() { return (myLength == 0) } 8 public int size() { return myLength; } 9 public void add(Obj o){ myStorage[myLength++] = o; } //Array has 46 other methods } Inter-class du analysis Souter & Pollock:99

DEF-USE Pairs Involving Inter-Class Interactions Class genericStack{ Array myStack; 1 public genericStack() { myStack = new Array(); } 2 public Object top() { return myStack.back(); } 3 public void push(Obj o){ myStack.pushBack(o); } 4 public Object pop() { return myStack.popBack(); } 5 public bool isEmpty() { return myStack.isEmpty(); } 6 public int size() { return myStack.size(); } } Class Array { Object myStorage[]; int myLength; 1 public Array() { myStorage = new Object[SIZE]; 2 myLength = 0; } 3 public Object back() { return myStorage[myLength-1];} 4 public Object popBack() { return myStorage[--myLength];} 5 public void pushBack(Obj o){ add(o); } 6 public Object front(Obj o) { return myStorage[0]; } 7 public bool isEmpty() { return (myLength == 0) } 8 public int size() { return myLength; } 9 public void add(Obj o){ myStorage[myLength++] = o; } //Array has 46 other methods } Inter-class du analysis Souter & Pollock:99

Research Goals To develop a new approach to testing object-oriented software that: Provides structural testing tailored to OO codes association between objects and fields include object creation site with def-use pair handle complex class interactions Program representation scales to large software systems Provides feedback to the tester Provides information on external influences of the testing results Provides the tester with direction in how to test an incomplete program

Outline Object-Oriented Program Characteristics Illustration of Def-Use Pairs Research Goals Our Solution Basic Object Manipulations Annotated Points-to Escape Graph OMEN: Test Tuple Construction Algorithm Work in Progress

Basic Object Manipulations

Basic Object Manipulations

Basic Object Manipulations

Points-to-Escape-Graph Terminology Nodes inside outside load return value Edges Node insert(Object e) { Node temp = new Node (e,this); return temp; } e data next this temp Whaley & Rinard: OOPSLA99

Extensions to the Points-to-Escape Graph:APE Graph 1: public push( Object e){ 2: if(top == null) 3: top = new Node(e, null); 4: else 5: top = top.insert(e); } 6: Node (Object e, Node n ){ 7: data = e; 8: next = n; this e

Extensions to the Points-to-Escape Graph:APE Graph 1: public push( Object e){ 2: if(top == null) 3: top = new Node(e, null); 4: else 5: top = top.insert(e); } 6: Node (Object e, Node n ){ 7: data = e; 8: next = n; this e top,2,load

Extensions to the Points-to-Escape Graph:APE Graph 1: public push( Object e){ 2: if(top == null) 3: top = new Node(e, null); 4: else 5: top = top.insert(e); } 6: Node (Object e, Node n ){ 7: data = e; 8: next = n; this e data,3-7,store 3 next,3-8,store T top,3,store top,2,load

OMEN - Test Tuple Construction Algorithm Computes a set of testing tuples for the component under test, based on object manipulations. Input: set of call graphs for component under test Output: set of testing tuples for component under test Traverse call graph in topological order Process each method’s APE graph For each store annotation per unmarked APE graph edge find the associated loads occurring after the store find object creation site associated with the tuple depends on the type of source node of the APE graph report feedback using the escape information of the APE graph

Traverse the Call Graph in Topological Order main push pop Stack isempty println get remove Node insert

Traverse the Call Graph in Topological Order main: 1 push: 3 pop:7 Stack:2 isempty:6 println:10 get:8 remove:9 Node:4 insert:5

Processing a Method’s APE Graph x,22 Integer 20 20 data:9 data:8 next:7 20-6-29 next:5 20-4 top:2 next:6 next:4 s,18 18 top:1 top:3

Processing a Method’s APE Graph x,22 Integer 20 20 data:9 data:8 next:7 20-6-29 next:5 20-4 top:2 next:6 next:4 s,18 18 top:1 top:3

Processing a Method’s APE Graph x,22 Integer 20 20 data:9 data:8 next:7 20-6-29 next:5 20-4 top:2 next:6 next:4 s,18 18 top:1 top:3

Avoiding Duplicate Tuples Through Marking this e 1 data, 4-10-7, store data,3-7,store 4 3 T top,3,store next,3-8,store next,4-10-8,store top,2,load 2 Marked edge Non-marked edge top,4,store Edges are marked during interprocedural merges of ape graph construction.

Processing Incomplete Components x,22 top:1 s,18 18 top:2 top:4 top:3 Feedback: value loaded is potentially changed by method outside CUT.

Processing Incomplete Components x,22 top:1 s,18 top:2 top:4 top:3 Feedback: value loaded is potentially changed by method outside CUT.

Processing Incomplete Components x,22 top:1 s,18 top:2 top:4 top:3 Feedback: value loaded is potentially changed by method outside CUT.

Work in Progress APE Graph Test Tuple Construction Algorithm Implementation of the APE graph Empirical study of the space and time requirements Empirical characterization study of the object manipulations in real object-oriented codes Test Tuple Construction Algorithm Algorithm extensions to include coverage for object manipulations based on references only Algorithm modifications - more sophisticated techniques to eliminate infeasible paths Evaluation of the algorithm