Professional Documents
Culture Documents
Masters Thesis
08/01/2003
SelectText SelectText
Format Font 18 OK
(“This”) (“text”)
1
TEST ORACLE
Test Case
Oracle Run-time
information from
Information executing GUI
Generator
Expected GUI State
• Oracle Procedure
• Actual Output <==> Oracle Information
• May be a set of rules for checking actual output
• May be an equality check
2
CHALLENGES OF THIS WORK
• Design GUI representation that can be tuned
to create multiple test oracles for GUIs
• Design multiple oracle information for GUIs
• Develop compatible oracle procedure for
GUIs
• Develop metrics for comparing different types
of GUI test oracles
OUTLINE
• Related Work
• GUI State
• Oracle Information
• Oracle Procedure
• Combining Oracle
Information and Procedure
• Experiments
• Tool support
• Fault seeding
• Results
3
RELATED WORK
• TAOS: Testing and Analysis with Oracle
Support, D.J. Richardson, ISSTA 1994.
• Manual
• Specification based
• TOBAC: A Test Case Browser for Testing
Object-Oriented Software, E. Siepman and
A.R. Newton, ISSTA 1994.
• Suggests 7 different oracles for object oriented
programs
OUTLINE
• Related Work
• GUI State
• Oracle Information
• Oracle Procedure
• Combining Oracle
Information and Procedure
• Experiments
• Tool support
• Fault seeding
• Results
4
TEST CASE AND GUI STATE
T = e1 e2 … ei … en-1 en
S0 S1 S2 … Si-1 Si … Sn-1 Sn
INITIAL STATE
GUI STATE
A GUI Window Properties of
Color = “Grey”
Height = 40
Width = 100
Text = “Cancel”
A WIDGET
State S = {(wi , pj , vk )}
Where SFIND = { (“Cancel”, “Color”, “Grey”),
w? W (“Cancel”, “Height”, 40),
p? P (“Cancel”, “Width”, “100”),
v? V (“Cancel”, “Text”, “Cancel”), …
}
• State of the entire GUI is the union of all window states
• Multiple types of oracle information can be created by selecting subset 10
5
OUTLINE
• Related Work
• GUI State
• Oracle Information
• Oracle Procedure
• Combining Oracle
Information and Procedure
• Experiments
• Tool support
• Fault seeding
• Results
11
Oracle Run-time
information from
Information executing GUI
Generator
Oracle Information
6
ORACLE INFORMATION
• Given a Test Case T = < S0; e1, e2, …, en >
• S0 = State of GUI before executing T
• ei = ith event of test case
• Oracle Information OI = < S1 ,… Sn>
• Si = State of GUI after event e i is executed
• Si may be complete or partial state of GUI
13
WIDGET – LOI1
T = e1 e2 … Cancel … en-1 en
S0 S1 S2 … Si-1 Si … Sn-1 Sn
• After each event ei, select triples for the active widget ww,j
• ww,j is the widget on which event ei is executed
14
7
ACTIVE WINDOW – LOI2
T = e1 e2 … match case … en-1 en
S0 S1 S2 … Si-1 Si … Sn-1 Sn
isVisible = TRUE
T = e1 e2 … ei … en-1 en
isVisible = TRUE
isVisible = FALSE
S0 S1 S2 … Si-1 Si … Sn-1 Sn
• SAPP(t) = { (wi , pj , vk )}
• After each event ei, select triples for all the visible windows
16
8
ALL WINDOWS – LOI4
T = e1 e2 … ei … en-1 en
S0 S1 S2 … Si-1 Si … Sn-1 Sn
• SAPP(t) = { (wi , pj , vk )}
• After each event ei, select all triples for all the windows
• All triples taken together is the complete state of the GUI
17
OUTLINE
• Related Work
• GUI State
• Oracle Information
• Oracle Procedure
• Combining Oracle
Information and Procedure
• Experiments
• Tool support
• Fault seeding
• Results
18
9
ORACLE PROCEDURE
• At specified times, while executing a test case,
compares the actual state of the executing GUI with
the Oracle Information (OI), using some constraints.
AS = actual state OI = expected state
Level of Oracle
Procedure
WIDGET – LOP1
OI = Oracle Information
(wX,1, p1, v1) (wY ,1, p1, v1) (wZ,1, p1, v1) (wX,1, p1, v1) (wY ,1, p1, v1)
(wX,2, p2, v1) (wY ,2, p2, v1) (wZ,2, p2, v1) (wX,2, p2, v1) (wY ,2, p2, v1)
… … … … …
(wX,…, pt , v1) (wY ,…, px , v1) (wZ,…, pa, v1) (wX,…, pt , v1) (wY ,…, px , v1)
(wX,…, p1, v1) (wY ,…, p1, v1) (wZ,…, p1, v1) (wX,…, p1, v1) (wY ,…, p1, v1)
(wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1) (wX,…, p2, v1) (wY ,…, p2, v1)
… … … … …
(wX,…, pu, v1) (wY ,…, py , v1) (wZ,…, pb, v1) (wX,…, pu, v1) (wY ,…, py , v1)
(wX,…, p1, v1) (wY ,…, p1, v1) (wz,…, p1, v1) (wX,…, p1, v1) (wY ,…, p1, v1)
(wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1) (wX,…, p2, v1) (wY ,…, p2, v1)
… … … LOP1 … …
(wX,n, pv , v1) (wY ,o, pz, v1) (wZ,o, pc , v1) (wX,n, pv , v1) (wY ,o, pz, v1)
Window X Window Y Window Z Window X Window Y
Verdict
10
ACTIVE WINDOW – LOP2
AS = Actual State OI = Oracle Information
(wX,1, p1, v1) (wY ,1, p1, v1) (wZ,1, p1, v1) (wX,1, p1, v1) (wY ,1, p1, v1)
(wX,2, p2, v1) (wY ,2, p2, v1) (wZ,2, p2, v1) (wX,2, p2, v1) (wY ,2, p2, v1)
… … … … …
(wX,…, pt , v1) (wY ,…, px , v1) (wZ,…, pa, v1) (wX,…, pt , v1) (wY ,…, px , v1)
(wX,…, p1, v1) (wY ,…, p1, v1) (wZ,…, p1, v1) (wX,…, p1, v1) (wY ,…, p1, v1)
(wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1) (wX,…, p2, v1) (wY ,…, p2, v1)
… … … … …
(wX,…, pu, v1) (wY ,…, py , v1) (wZ,…, pb, v1) (wX,…, pu, v1) (wY ,…, py , v1)
(wX,…, p1, v1) (wY ,…, p1, v1) (wz,…, p1, v1) (wX,…, p1, v1) (wY ,…, p1, v1)
(wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1) (wX,…, p2, v1) (wY ,…, p2, v1)
… … … LOP2 … …
(wX,n, pv , v1) (wY ,o, pz, v1) (wZ,m , pc , v1) (wX,n, pv , v1) (wY ,o, pz, v1)
Window X Window Y Window Z Window X Window Y
Verdict
•After each event ei, select triples, from AS and OI, for the active
window
• Active Window is W on which event ei is executed
21
• After each event ei, select triples, from AS and OI, for all visible
windows
22
11
ALL WINDOWS – LOP4
AS = Actual State OI = Oracle Information
(wX,1, p1, v1) (wY ,1, p1, v1) (wZ,1, p1, v1) (wX,1, p1, v1) (wY ,1, p1, v1) (wZ,1, p1, v1)
(wX,2, p2, v1) (wY ,2, p2, v1) (wZ,2, p2, v1) (wX,2, p2, v1) (wY ,2, p2, v1) (wZ,2, p2, v1)
… … … … … …
(wX,…, pt , v1) (wY ,…, px , v1) (wZ,…, pa, v1) (wX,…, pt , v1) (wY ,…, px , v1) (wZ,…, pa, v1)
(wX,…, p1, v1) (wY ,…, p1, v1) (wZ,…, p1, v1) (wX,…, p1, v1) (wY ,…, p1, v1) (wZ,…, p1, v1)
(wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1) (wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1)
… … … … … …
(wX,…, pu, v1) (wY ,…, py , v1) (wZ,…, pb, v1) (wX,…, pu, v1) (wY ,…, py , v1) (wZ,…, pb, v1)
(wX,…, p1, v1) (wY ,…, p1, v1) (wz,…, p1, v1) (wX,…, p1, v1) (wY ,…, p1, v1) (wz,…, p1, v1)
(wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1) (wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1)
… … … LOP4
… … …
(wX,n, pv , v1) (wY ,o, pz, v1) (wZ,o, pc , v1) (wX,n, pv , v1) (wY ,o, pz, v1) (wZ,o, pc , v1)
• After each event ei, select all triples from AS and OI for all
the windows
23
(wX,…, p1, v1) (wY ,…, p1, v1) (wZ,…, p1, v1) (wi, p1, v1) (wi, p1, v1) (wi, p1, v1)
(wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1) (wi, p2, v1) (wi, p2, v1) (wi, p2, v1)
… … … … … …
(wX,…, pu, v1) (wY ,…, py , v1) (wZ,…, pb, v1) (wi, pn, v1) (wi, pn, v1) (wi, pn, v1)
(wX,…, p1, v1) (wY ,…, p1, v1) (wz,…, p1, v1) (wm , p1, v1) (wm , p1, v1) (wm , p1, v1)
(wX,…, p2, v1) (wY ,…, p2, v1) (wZ,…, p2, v1) (wm , p2, v1) (wm , p2, v1) (wm , p2, v1)
… … … LOP5 … … …
(wX,n, pv , v1) (wY ,o, pz, v1) (wZ,o, pc , v1) (wm , pn, v1) (wm , pn, v1) (wm , pn, v1)
24
12
OUTLINE
• Related Work
• GUI State
• Oracle Information
• Oracle Procedure
• Combining Oracle
Information and Procedure
• Experiments
• Tool support
• Fault seeding
• Results
25
(wi, p1, v1) (wi, p1, v1) (wi, p1, v1) (wii, p11, v11) (wi, p1, v1) (wi, p1, v1)
(wi, p2, v1) (wi, p2, v1) (wi, p2, v1) (w (wi, p2, v1) (wi, p2, v1)
… … … (wii,, pp22,, vv11))
… … …
(wi, pn, v1) (wi, pn, v1) (wi, pn, v1) (wi, p…n, v1) (wi, pn, v1) (wi, pn, v1)
13
TYPES OF ORACLES
• An oracle procedure may use less than available
oracle information (OI)
• The OI can be generated before running the test case
• Depending on resources available at OI collection,
different OI is created
• Depending on resources available at test case
execution time, the oracle procedure may use a subset
of available OI
• The 4 LOI and 5 LOP can be combined into 11 test
oracles
27
LOI1 X
LOI2 X X
LOI3 X X X
LOI4 X X X X X
14
OUTLINE
• Related Work
• GUI State
• Oracle Information
• Oracle Procedure
• Combining Oracle
Information and Procedure
• Experiments
• Tool support
• Fault seeding
• Results
29
QUESTIONS
30
15
APPROACH
• 4 applications
• Seeded 100 faults to create 100 mutants
• Generated 600 test cases for each application
• Reported results of 4 x 100 x 600 = 240,000
test case runs
31
PROCESS
• Generate test cases
• Run test case on correct application
• Collect oracle information (LOI1-LOI4)
• Run test case on mutants
• Compare the actual state with stored oracle
information using different levels of oracle
procedure (LOP1-LOP5)
32
16
SUBJECT APPLICATIONS
• Subject Applications
• TerpOffice – 4 Java applications
• Developed by students of undergraduate software
engineering (CMSC 435)
33
MUTANTS
• Seeded single fault in original code to create
one mutant
• Single fault avoids fault interaction
• Easier to identify a fault when a mutant it
killed
• Seeded 100 faults for each application
• Total 400 mutants
34
17
KILL MUTANTS
• A mutant is ‘killed’ when a test case
distinguishes it from the original application
• Execute a test case on each mutant
• Compare actual output, AS, of mutant with
expected output from OI
• Use different types of oracle for comparing
• Using different oracles, a mutant may or may not
be killed for a test case
• Execute 600 test cases for each application
35
TOOL SUPPORT
• Manual process
• Executing a test case with 20 events takes
minute
• Observing and recording Oracle
Information is time consuming
• Comparing actual state with expected state
is time consuming
• Automated the entire process
36
18
TOOL SUPPORT
GUI
APPLICATION
REPRESENTATION
GUI TEST
TEST CASES ORACLE INFORMATION
REPORT
OUTLINE
• Related Work
• GUI State
• Oracle Information
• Oracle Procedure
• Combining Oracle
Information and Procedure
• Experiments
• Tool support
• Fault seeding
• Results
38
19
ORACLE INFORMATION
GENERATION TIME
14
12
LOI1
Time (hours)
10
LOI2
8
LOI3
6 LOI4
4 Final State
2
0
TerpPresent TerpWord TerpSpreadSheet TerpPaint
Final state required least time because only one state was queried
39
250
200
Storage Size (MB)
LOI1
150 LOI2
LOI3
100 LOI4
Final state
50
0
TerpPresent TerpWord TerpSpreadSheet TerpPaint
20
COMPARISON TIME
700
600
500
LOP1
Time (hours)
400 LOP2
LOP3
300 LOP4
LOP5
200
100
0
TerpPresent TerpWord TerpSpreadSheet TerpPaint
TYPES OF ORACLES
LOP1 LOP2 LOP3 LOP4 LOP5
LOI1 X L1
LOI2 X X L2
LOI3 X X X L3
LOI4 X X X X L4 X L5
21
FRACTION OF FAULTS
100
80
% of Faults Detected
L1
60 L2
L3
40 L4
L5
20
0
TerpPresent TerpWord TerpSpreadSheet TerpPaint
and L2 LOI3
LOI4
X
X
X
X
X
X
L3
X L4 X L5
43
5000
4000 L1
L2
3000
L3
2000 L4
1000
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Test Case Length
44
22
NUMBER OF FAULTS DETECTED BY A
TEST CASE
2000
1500
Number of Test cases
2000
1000 1800
1600
LESSONS LEARNED
• Different oracles have different cost and fault
detection ability
• Use of “Final State” is cost effective
• Less storage and generation time
• Found almost as many fault as “Visible Window”
and “All Windows”
• If short test cases are available
• Use an “Visible Windows” and “All Windows”
• “Final State” may miss faults that are masked,
by the time the last event is executed
46
23
CONTRIBUTIONS
• Defined GUI state, so that is can be tuned to
create multiple test oracles
• Developed GUI test oracles
• Oracle information
• Oracle procedure
• Developed tools for experiment
• Designed and conducted an experiment
• Developed guidelines for GUI testing
47
BROADER IMPACTS
• Applied multiple test oracles for effective
regression testing (ICSM 2003)
• Developed reverse engineering tool for GUIs
(WCRE 2003)
• Compared multiple test oracles for GUI testing
(ASE 2003)
• Collaborated with Hughes Network Systems
on developing testing tools
48
24
FUTURE WORK
• Metrics to evaluate and compare test oracles
• Use Windows applications as subjects
• Generate multiple types of test cases and
observe the effect of different oracles
49
25