Presentation is loading. Please wait.

Presentation is loading. Please wait.

OMEN: A Strategy for Testing Object-Oriented Software

Similar presentations


Presentation on theme: "OMEN: A Strategy for Testing Object-Oriented Software"— Presentation transcript:

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

2 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

3 Illustrating Kinds of DEF-USE Pairs
Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ if(size() == 0) return error; int temp = myStack[top-1]; top--; 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

4 Illustrating Kinds of DEF-USE Pairs
Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ if(size() == 0) return error; int temp = myStack[top-1]; top--; 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

5 Illustrating Kinds of DEF-USE Pairs
Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ if(size() == 0) return error; int temp = myStack[top-1]; top--; 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

6 Illustrating Kinds of DEF-USE Pairs
Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ if(size() == 0) return error; int temp = myStack[top-1]; top--; 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

7 Illustrating Kinds of DEF-USE Pairs
Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ if(size() == 0) return error; int temp = myStack[top-1]; top--; 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

8 Illustrating Kinds of DEF-USE Pairs
Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ if(size() == 0) return error; int temp = myStack[top-1]; top--; 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

9 Illustrating Kinds of DEF-USE Pairs
Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ if(size() == 0) return error; int temp = myStack[top-1]; top--; 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

10 Illustrating Kinds of DEF-USE Pairs
Class Stack{ int myStack[]; int top; 1 public Stack(int s){ myStack = new int[s]; top = 0; } 3 public void push(int obj){ myStack[top++] = obj; } 4 public int pop(){ if(size() == 0) return error; int temp = myStack[top-1]; top--; 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

11 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]; 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

12 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]; 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

13 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]; 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

14 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]; 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

15 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]; 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

16 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

17 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

18 Basic Object Manipulations

19 Basic Object Manipulations

20 Basic Object Manipulations

21 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

22 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

23 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

24 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

25 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

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

27 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

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

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

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

31 Avoiding Duplicate Tuples Through Marking
this e 1 data, , 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.

32 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.

33 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.

34 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.

35 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


Download ppt "OMEN: A Strategy for Testing Object-Oriented Software"

Similar presentations


Ads by Google