1. Cross-Platform
Testing and Maintenance of
Web and Mobile Applications
PhD Thesis Defense
Shauvik Roy Choudhary
Advisor: Dr. Alessandro Orso
School of Computer Science, Georgia Tech
Committee:
Dr. Mayur Naik, Dr. Milos Prvulovic
Dr. Russ Clark, Dr. Mukul Prasad
1
11. Thesis
• Key Insight: Analyze cross-platform application
behavior to address the problems
• Challenge: Significant difference in cross-
platform behavior. Match behavior despite
legitimate differences.
• Thesis: Approximate matching algorithms with
the right abstractions can be used to automate
cross-platform testing and maintenance.
11
19. Evaluation Subjects
19
Name Type URL States Transitions
Organizer Productivity http://localhost/organizer 13 99
GrantaBooks Publisher http://grantabooks.com 9 8
DesignTrust Business http://designtrust.org 10 20
DivineLife Spiritual http://sivanandaonline.org 10 9
SaiBaba Religious http://shrisaibabasansthan.org 13 20
Breakaway Sport http://breakaway-adventures.com 19 18
Conference Information http://localhost/conference 3 12
Fisherman Restaurant http://fishermanslodge.co.uk 15 17
Valleyforge Lodge http://valleyforgeinn.net 4 12
UniMelb University http://www.economics.unimelb.edu.au/ACT/ 9 8
Konqueror Software http://www.konqueror.org 5 4
UBC Club http://www.ubcsororities.com 7 7
BMVBS Ministry http://m.bmvbs.de 5 20
StarWars Movie http://www.starwarsholidayspecial.com 10 9
Prior Art (6)
Example & Survey (4)
Random (4)
20. Evaluation
• RQ1: Can X-PERT find Cross-Browser
Issues in real web applications?
• RQ2: How does X-PERT compare to the
state-of-art?
45%↑ Precision and 14%↑ Recall
Yes!
77% Precision and 95% Recall
20
25. Overall Approach
Platforms
Trace
Extraction
Traces
1
Action
Recognition
A
X
B
Y
C
D
A
B
C
D
A
Q
R
S
A
Q
R
Q
R
S
M
N
O
P
U
V
W
Labeled Actions
A
B
C
D
A
Q
R
S
2 1. REQUEST: GET /index.php
2. RESPONSE: 200 OK, 'text/html'
3. REQUEST: GET /style.css
4. REPONSE: 200 OK, 'text/css'
5. REQUEST: GET /logo.png
6. REPONSE: 200 OK, 'image/png'
7. REQUEST: GET /script.js
8. REPONSE: 200 OK, 'text/javascript'
9. REQUEST: POST /login.php
user=user1&pass=..&sid=w2s31
10. RESPONSE: 200 OK, 'text/html'
....
11. REQUEST: POST /create_blog.php
title=..&content=..
12. RESPONSE: 200 OK, 'text/html'
Domain specific
vocabulary to identify
keywords in requests
Ignore requests
to stylistic resources
25
26. 1. REQUEST: GET /index.php
2. RESPONSE: 200 OK, 'text/html'
3. REQUEST: GET /style.css
4. REPONSE: 200 OK, 'text/css'
5. REQUEST: GET /logo.png
6. REPONSE: 200 OK, 'image/png'
7. REQUEST: GET /script.js
8. REPONSE: 200 OK, 'text/javascript'
9. REQUEST: POST /login.php
user=user1&pass=..&sid=w2s31
10. RESPONSE: 200 OK, 'text/html'
....
11. REQUEST: POST /create_blog.php
title=..&content=..
12. RESPONSE: 200 OK, 'text/html'
Overall Approach
Platforms
Trace
Extraction
Traces
1
Action
Recognition
A
X
B
Y
C
D
A
B
C
D
A
Q
R
S
A
Q
R
Q
R
S
M
N
O
P
U
V
W
Labeled Actions
A
B
C
D
A
Q
R
S
2 1. REQUEST: GET /index.php
2. RESPONSE: 200 OK, 'text/html'
3. REQUEST: GET /style.css
4. REPONSE: 200 OK, 'text/css'
5. REQUEST: GET /logo.png
6. REPONSE: 200 OK, 'image/png'
7. REQUEST: GET /script.js
8. REPONSE: 200 OK, 'text/javascript'
9. REQUEST: POST /login.php
user=user1&pass=..&sid=w2s31
10. RESPONSE: 200 OK, 'text/html'
....
11. REQUEST: POST /create_blog.php
title=..&content=..
12. RESPONSE: 200 OK, 'text/html'
(‘index’),
(‘script’),
(‘login’,‘user’,‘pass’,‘sid’),
(‘create’,‘blog’,‘title’,‘content’)
Keywords
26
31. Evaluation
• Tool: FMAP (Feature Mapping Across Platforms)
• Subjects: Popular web apps (6 open source + 3 public)
Subject Type Mobile plug-in
wordpress Blogging wordpress mobile pack
drupal Content Management nokia mobile theme
phpbb Forum artodia mobile style
roundcube Email mobilecube theme
elgg Social Networking elgg mobile module
gallery Photo Management imobile theme
wikipedia.org Wiki -
stackoverflow.com Q&A -
twitter.com Social Networking -
31
32. Evaluation
• RQ1: How effective is FMAP in recognizing
web application actions?
• RQ2: How effective is FMAP in matching
features between the desktop and mobile
versions of real web applications?
Accuracy: 86.3% (FMAP)
51.5% (Baseline)
Accuracy: 97.8% (Desktop)
99.6% (Mobile)
32
33. Evaluation
• RQ1: How effective is FMAP in recognizing
web application actions?
• RQ2: How effective is FMAP in matching
features between the desktop and mobile
versions of real web applications?
Accuracy: 86.3% (FMAP)
51.5% (Baseline)
Accuracy: 97.8% (Desktop)
99.6% (Mobile)
40
50
Missing features reported by FMAP
confirmed from user reports & software fixes
33
40. MyList App - Test Migration
View Items
Add Item
MyList
Items
MyList Item
MyList
TAP “MyList Item”TAP “View Items”
Items
Delete
MyList Item
Star
MyList
TAP “Star”
Items
MyList Item
MyList
AssertExists “Star”
MyList Item >
MyList +
TAP “MyList Item”
MyList Item
MyList +
Delete ItemStar Item
TAP “Star Item”
MyList Item >
MyList +
AssertExists “Star”
40
41. Challenges
Independently
developed
(In different languages
& frameworks)
Posts
tap
"New Post"
tap
"Refresh"
tap
"More Options"
tap
"Hello World!"
Menu
tap "Open drawer"
tap "Posts"
tap "Comments"
tap "Media"
tap "Pages"
tap
tap "Navigate up"
tap "Upload"
type "Title"
tap "Content"
tap
"Post Settings"
type "Content"
BACK button
tap
"Navigate up"
tap
"Navigate up"
tap "Delete Post"
tap
"Preview"
tap "Preview Post"
tap "Share URL"
tap "Add Comment"
tap "Edit Post"
tap "Sign out"
tap "Settings"
Automated
Behavior
Exploration
Same actions
Different Widgets
No structural
similarity
Partial
Consider all
possibilities
41
42. Assumptions
• Action correspondence:
1-1 correspondence between actions
• Action ordering:
Is preserved in matched use cases
• Functionality under test:
present on both platforms
42
43. Intuition
Test Case Model Generation
Init
State
State
A
State
B
State
C
Action 1
Action 2
Action 3
Oracle
Init
State
State
1
State
5
State
6
State
2
State
3
State
4
State
7
Init
State
State
1
State
5
State
6
State
2
State
3
State
4
State
7
PLATFORM 1 PLATFORM 2
43
44. Model Definition
Labeled Transition System (LTS)
(S, s0, A, δ)
Transition
Function
Initial state
Actions
States
δ(scurrent,a) = snext
44
View Items
Add Item
MyList
Items
MyList Item
MyList
45. Solving for maximizing matching
Given:
Constraint:
Where:
•
•
Subject to:
•
Model for Platform 2:
Test Trace for Platform 1:
a & b are from
platforms p1 & p2
45
46. Solving for maximizing matching
Given:
Constraint:
Subject to:
•
•
•
a & b are from
platforms p1 & p2
Model for Platform 2:
Test Trace for Platform 1:Ordering Constraint
on matched actions
ai aj
bx by
46
47. Solving for maximizing matching
Given:
Constraint:
Subject to:
•
•
•
a & b are from
platforms p1 & p2
Model for Platform 2:
Test Trace for Platform 1:No Invalid Ordering
between matched actions
ai aj
bx bybz
ak
47
48. Solving for maximizing matching
Given:
Constraint:
Where:
•
•
Subject to:
•
Model for Platform 2:
Test Trace for Platform 1:
a & b are from
platforms p1 & p2
48
49. Technique Overview
Platform 1
App
Platform 2
App
Test Trace
Generation
Platform 1
Tests
Incremental
Model
Generation
Platform 1
Test Trace
Test
Generation
Platform 2
Tests
Model-Trace
Mapping
1 2 3
49
51. Technique Overview
Platform 1
App
Platform 2
App
Test Trace
Generation
Platform 1
Tests
Incremental
Model
Generation
Platform 1
Test Trace
Test
Generation
Platform 2
Tests
Model-Trace
Mapping
1 2 3
51
52. 1. Trace Generation
MyList Item >
MyList +
TAP “MyList Item”
TAP
<“cell”, “”, “”, “MyList Item”, 0>
Action Widget Information:
• Class Name
• ID
• Name
• Value
• Position in Parent
52
53. 1. Trace Generation
TAP “MyList Item”
TAP “Star Item”
AssertExists “Star”
Test
TAP <“cell”, “”, “”, “MyList Item”, 0>
TAP <“button”, “”, “btn1”, “Star Item”, 0>
AssertExists <“icon”, “Star”, “”, “”, 0>
Test Trace
53
55. General Model Exploration
INPUT:
Application under Test
ALGO:
Model ← (S, s0, A, δ) | S = {s0}, A=ϵ, δ=ϵ
Worklist ← s0.actions()
While (Worklist.size > 0) and time() < TIMEOUT
(s, a) ← getNextAction(Worklist)
snext ← doAction(s, a)
if snext ∉ S
Worklist ← snext.actions()
Model.add(s, a, snext)
Return Model
View Items
Add Item
MyList
Items
MyList Item
MyList
55
56. MigraTest Model Exploration
INPUT:
Application under Test
Test Traceset = {<a1, a2, …, an>, …}
ALGO:
Model ← (S, s0, A, δ) | S = {s0}, A=ϵ, δ=ϵ
Worklist ← s0.actions()
While (Worklist.size > 0) and time() < TIMEOUT
Sol ← MaxMatchSolve(Model, Traceset)
(s, a) ← Sol.getNextAction(Worklist)
snext ← doAction(s, a)
if snext ∉ S
Worklist ← snext.actions()
Model.add(s, a, snext)
Return Model, Sol.Map
MigraTest decides
what to explore
56
57. getNextAction
• Intuition: Prioritize clicks based on action similarity
and scope of new potential assignments
Cross-platform action similarity
(widget similarity & action compatibility)
Number of unassigned
dependent actions
57
58. Solving for Matching
a1
a2
a3
b1 b2
∼
∼
∼ ∼
∼
∼
TAP “MyList Item”
TAP “Star Item”
TAP “Delete Item”
TAP
“View
Item
s”
TAP
“Add
Item
”
?
?✔
TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
58
59. TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
Items
MyList Item
MyList
Add Item
MyList
Item Name
Add
TAP
"MyList Item"
TAP
"Add"
Type
"Item Name"
b3
b4
b5
59
60. Solving for Matching
a1
a2
a3
b1 b2 b3 b4 b5
=
∼
∼
∼
∼ ∼
∼
∼ ∼
TAP “MyList Item”
TAP “Star Item”
TAP “Delete Item”
TAP
“M
yListItem
”
TAP
“View
Item
s”
TAP
“Add
Item
”
TYPE
“Item
Nam
e”
TAP
“Add”
✔
TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
Items
MyList Item
MyList
Add Item
MyList
Item Name
Add
TAP
"MyList Item"
TAP
"Add"
Type
"Item Name"
b3
b4
b5
60
? ?
? ?
61. TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
Items
MyList Item
MyList
Add Item
MyList
Item Name
Add
TAP
"Add"
Type
"Item Name"
b3
b4
b5
Items
Delete
MyList Item
Star
MyList
TAP
"MyList Item"
TAP
"Star"
TAP
"Delete"
b6 b7
TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
Items
MyList Item
MyList
Add Item
MyList
Item Name
Add
TAP
"MyList Item"
TAP
"Add"
Type
"Item Name"
b3
b4
b5
61
62. Solving for Matching
a1
a2
a3
b1 b2 b3 b4 b5 b6 b7
=
∼ ∼
∼
∼
∼
∼ ∼
∼
∼ ∼
✔
✔
TAP “MyList Item”
TAP “Star Item”
TAP “Delete Item”
TAP
“M
yListItem
”
TAP
“View
Item
s”
TAP
“Add
Item
”
TYPE
“Item
Nam
e”
TAP
“Add”TAP
“Star”
TAP
“Delete”
✔
62
? ?
? ?
Trace
Action
Model
Action
a1 b3
a2 b6
a3 b7
Trace-Model
Action Mapping
63. 3. Test Generation
Model
TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
Items
MyList Item
MyList
Add Item
MyList
Item Name
Add
TAP
"Add"
Type
"Item Name"
b3
b4
b5
Items
Delete
MyList Item
Star
MyList
TAP
"MyList Item"
TAP
"Star"
TAP
"Delete"
b6 b7
Trace
a2a1
a1 a3
Trace
Action
Model
Action
a1 b3
a2 b6
a3 b7
Trace-Model
Action Mapping63
64. 3. Test Generation
Trace
a2a1
a1 a3
Model
TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
Items
MyList Item
MyList
Add Item
MyList
Item Name
Add
TAP
"Add"
Type
"Item Name"
b3
b4
b5
Items
Delete
MyList Item
Star
MyList
TAP
"MyList Item"
TAP
"Star"
TAP
"Delete"
b6 b7
b3b1 b6
b3b1 b7
Trace
Action
Model
Action
a1 b3
a2 b6
a3 b7
Trace-Model
Action Mapping64
65. 3. Test Generation
Model
TAP
"View Items"
View Items
Add Item
MyList
TAP
"Add Item"
b1
b2
Items
MyList Item
MyList
Add Item
MyList
Item Name
Add
TAP
"Add"
Type
"Item Name"
b3
b4
b5
Items
Delete
MyList Item
Star
MyList
TAP
"MyList Item"
TAP
"Star"
TAP
"Delete"
b6 b7
b3b1 b6
b3b1 b7
Tap “View Items”
Tap “MyList Item”
Tap “Star”
Tap “View Items”
Tap “MyList Item”
Tap “Delete”
65
67. 3. Test Generation
(Oracle Migration)
AssertExists
selector
AssertText
selector ExpectedValue
AssertText
new_selector ExpectedValue
AssertExists
new_selector
new_selector :=
best_of(class, label, name, value, position)
Extra Checks
to catch potential migration issues
assertExists✔
Multiple elements exist
Element doesn’t exist yet (Flaky?)
Element exists but with different value
67
71. wikiHow: Test Cases
TEST CASE DESCRIPTION
Items loaded
When user selects category,
check if items in category are loaded
Page title
When user selects category,
check if page title matches category name
Back button
When user selects category & item, & presses button with
label “Back”, check if page title matches category name
Pop-up shown
When user selects category & item, & presses button with
label “Add”, check if pop-up is displayed to user
WebView loaded
When user selects category & item,
check if a WebView is added on the screen
71
72. wikiHow: Test Migration
TEST CASE MIGRATED CHALLENGE ISSUES FOUND
Items loaded Yes
Page title Yes Duplicates found
Back button Partial
Platform specific
functionality
Pop-up shown Partial
Missing
functionality
Missing
functionality
WebView loaded Yes
72
76. WhiteHouse: Test Cases
76
TEST CASE DESCRIPTION
Menu Loaded When the user taps on Menu, check if “BLOG” is present
Photo Loaded
When the user taps on Menu, and selects “PHOTOS”
check if the first photo is loaded
Video Loaded
When the user taps on Menu, and selects “VIDEOS” check
if the first photo is loaded
Search
When the user taps on Menu, and enters “A” in the search
bar, check if page contains “No Results”
77. WhiteHouse: Test Migration
77
TEST CASE MIGRATED CHALLENGE
POTENTIAL
ISSUES FOUND
Menu Loaded Yes
Photo Loaded Yes
Empty label on
Android
Video Loaded Yes
Empty label on
Android
Search Yes Text Input
79. Plans
• Submit unpublished work to ISSTA’15
• Capture-Replay project for “Testing Everywhere”
• NSF i-Corps Program to Commercialize Capture-
Replay technology for Business Intelligence
79