1
Automated Test Generation By Avoiding Redundant Tests
- Dept. of Computer Science & Engineering
University of Washington
5 Oct. 2004, Microsoft Research
Automated Test Generation By Avoiding Redundant Tests Tao Xie - - PowerPoint PPT Presentation
Automated Test Generation By Avoiding Redundant Tests Tao Xie Joint work with Darko Marinov (UIUC) and David Notkin Dept. of Computer Science & Engineering University of Washington 5 Oct. 2004, Microsoft Research 1 Motivation Tool
1
5 Oct. 2004, Microsoft Research
2
3
4
5
Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 2 (T2): IntStack s2 = new IntStack(); s2.push(3); s2.push(5); Test 3 (T3): IntStack s3 = new IntStack(); s3.push(3); s3.push(2); s3.pop();
6
7
8
9
10
Notation: methodName(entryState, methodArgs).state [Henkel&Diwan 03] Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 3 (T3): IntStack s3 = new IntStack(); s3.push(3); s3.push(2); s3.pop();
11
<init>( ).state
Notation: methodName(entryState, methodArgs).state [Henkel&Diwan 03] Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 3 (T3): IntStack s3 = new IntStack(); s3.push(3); s3.push(2); s3.pop();
12
<init>( ).state
Notation: methodName(entryState, methodArgs).state [Henkel&Diwan 03] Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 3 (T3): IntStack s3 = new IntStack(); s3.push(3); s3.push(2); s3.pop();
isEmpty( ).state
13
<init>( ).state
Notation: methodName(entryState, methodArgs).state [Henkel&Diwan 03] Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 3 (T3): IntStack s3 = new IntStack(); s3.push(3); s3.push(2); s3.pop();
isEmpty( ).state push( , 3).state s1.push 2
14
<init>( ).state
Notation: methodName(entryState, methodArgs).state [Henkel&Diwan 03] Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 3 (T3): IntStack s3 = new IntStack(); s3.push(3); s3.push(2); s3.pop();
isEmpty( ).state push( , 3).state s1.push 2 s3.push push(<init>( ).state, 3).state 2
15
s1.push s3.push push(<init>( ).state, 3).state push(isEmpty(<init>( ).state).state, 3).state
Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 3 (T3): IntStack s3 = new IntStack(); s3.push(3); s3.push(2); s3.pop();
2 2
16
s1.push s2.push
store.length = 3 store[0] = 3 store[1] = 2 store[2] = 0 size = 1
Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 2 (T2): IntStack s2 = new IntStack(); s2.push(3); s2.push(5);
store.length = 3 store[0] = 3 store[1] = 0 store[2] = 0 size = 1 5 5
Comparison by isomorphism
17
s1.push s2.push store.length = 3 store[0] = 3 store[1] = 2 store[2] = 0 size = 1 Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 2 (T2): IntStack s2 = new IntStack(); s2.push(3); s2.push(5); store.length = 3 store[0] = 3 store[1] = 0 store[2] = 0 size = 1
5 5
Comparison by isomorphism
18
s1.push s2.push Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 2 (T2): IntStack s2 = new IntStack(); s2.push(3); s2.push(5);
5 5
s1.equals(s2) == true
19
20
detected redundant tests w.r.t. T1
Test 1 (T1): IntStack s1 = new IntStack(); s1.isEmpty(); s1.push(3); s1.push(2); s1.pop(); s1.push(5); Test 2 (T2): IntStack s2 = new IntStack(); s2.push(3); s2.push(5); Test 3 (T3): IntStack s3 = new IntStack(); s3.push(3); s3.push(2); s3.pop();
21
22
23
24
25
26
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% IntStack UBStack ShoppingCart BankAccount BinSearchTree BinomialHeap DisjSet FibonacciHeap HashMap LinkedList TreeMap WholeSeq ModifyingSeq WholeState MonitorEquals PairwiseEquals
27
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 IntStack UBStack ShoppingCart BankAccount BinSearchTree BinomialHeap DisjSet FibonacciHeap HashMap LinkedList TreeMap WholeSeq ModifyingSeq WholeState MonitorEquals PairwiseEquals
28
29
(WholeSeq, ModifyingSeq, WholeState, MonitorEquals, PairwiseEquals)
30
31
32
33
34
after new IntStack()
35
after new IntStack()
push(3) push(2) push(5) pop() isEmpty()
36
after new IntStack()
push(3) push(2) push(5) pop() isEmpty() push(3) push(2) push(5) pop() isEmpty()
37
after new IntStack()
push(3) push(2) push(5) pop() isEmpty() push(3) push(2) push(5) pop() isEmpty()
38
39
SymbolicInt elem1 = new SymbolicInt(); SymbolicInt elem2 = new SymbolicInt(); IntStack s1 = new IntStack(); s1.push(elem1);
store.length = 3 store[0] = elem1 size = 1 State 1
40
SymbolicInt elem1 = new SymbolicInt(); SymbolicInt elem2 = new SymbolicInt(); IntStack s1 = new IntStack(); s1.push(elem1); s1.push(elem2);
store.length = 3 store[0] = elem1 size = 1 State 1 store.length = 3 store[0] = elem1 store[1] = elem2 size = 2 elem1 != elem2 elem1 == elem2 store.length = 3 store[0] = elem1 size = 1 State 3 State 2
41
SymbolicInt elem1 = new SymbolicInt(); SymbolicInt elem2 = new SymbolicInt(); IntStack s1 = new IntStack(); s1.push(elem1); s1.push(elem2);
store.length = 3 store[0] = elem1 size = 1 State 1 store.length = 3 store[0] = elem1 store[1] = elem2 size = 2 elem1 != elem2 elem1 == elem2 store.length = 3 store[0] = elem1 size = 1 State 3 State 2
42
SymbolicInt elem1 = new SymbolicInt(); SymbolicInt elem2 = new SymbolicInt(); IntStack s1 = new IntStack(); s1.push(elem1); s1.push(elem2);
store.length = 3 store[0] = elem1 size = 1 State 1 store.length = 3 store[0] = elem1 store[1] = elem2 size = 2 elem1 != elem2 elem1 == elem2 store.length = 3 store[0] = elem1 size = 1 State 3 State 2
43
44
45
after new IntStack()
push(3) push(2) push(5) pop() isEmpty() push(3) push(2) push(5) pop() isEmpty()
46
after new UIntStack()
push(elem1)
push(elem2) elem1 != elem2 push(elem3) elem1 != elem2 && elem3 != elem1 && elem3 != elem2
47
after new UIntStack()
push(elem1) push(elem2) elem1 != elem2 push(elem3) elem1 != elem2 && elem3 != elem1 && elem3 != elem2
Integer push_0_1 = new Integer(-999998); Integer push_0_3 = new Integer(-999999); Integer push_0_2 = new Integer(-1000000); UIntStack u1 = new UIntStack(); u1.push(push_0_1); u1.push(push_0_2); u1.push(push_0_3); Integer push_0_1 = new Integer(-1000000); Integer push_0_2 = new Integer(-999999); UIntStack u1 = new UIntStack(); u1.push(push_0_1); u1.push(push_0_2);
48
Pentium IV 2.8 GHz Sun JDK 1.4.2 with 512MB allocated mem
49
50
51
52
53
54
55
50 100 150 200 250 300 I n t S t a c k U B S t a c k S h
p i n g C a r t B a n k A c c
n t B i n S e a r c h T r e e B i n
i a l H e a p D i s j S e t F i b
a c c i H e a p H a s h M a p L i n k e d L i s t T r e e M a p WholeSeq ModifyingSeq WholeState MonitorEquals PairwiseEquals
56
1 2 3 4 5 6 7 8 IntStack UBStack ShoppingCart BankAccount BinSearchTree BinomialHeap DisjSet FibonacciHeap HashMap LinkedList TreeMap WholeSeq ModifyingSeq WholeState MonitorEquals PairwiseEquals
57
SymbolicInt elem1 = new SymbolicInt(); SymbolicInt elem2 = new SymbolicInt(); IntStack s1 = new IntStack(); s1.push(elem1);
store.length = 3 store[0] = elem1 size = 1 State 1
58
store.length = 3 store[0] = elem1 store[1] = elem2 size = 2
SymbolicInt elem1 = new SymbolicInt(); SymbolicInt elem2 = new SymbolicInt(); IntStack s1 = new IntStack(); s1.push(elem1); s1.push(elem2);
elem1 != elem2 elem1 == elem2 store.length = 3 store[0] = elem1 size = 1 State 2 State 1
59
SymbolicInt elem1 = new SymbolicInt(); SymbolicInt elem2 = new SymbolicInt(); IntStack s1 = new IntStack(); s1.push(elem1); s1.push(elem2);
push(<init>().state, elem1).state State 1 push( push(<init>().state, elem1).state, elem2).state elem1 != elem2 elem1 == elem2 State 3 State 2 push( push(<init>().state, elem1).state, elem2).state