+ All Categories
Home > Engineering > Using Robots for App Testing

Using Robots for App Testing

Date post: 14-Apr-2017
Category:
Upload: shauvik-roy-choudhary-phd
View: 179 times
Download: 0 times
Share this document with a friend
44
USING ROBOTS FOR ANDROID APP TESTING Shauvik Roy Choudhary PhD, Georgia Tech Founder, MoQuality @shauvik http://shauvik.com http://moquality.com
Transcript
Page 1: Using Robots for App Testing

USING ROBOTS FOR ANDROID APP TESTING

Shauvik Roy ChoudharyPhD, Georgia TechFounder, MoQuality

@shauvikhttp://shauvik.comhttp://moquality.com

Page 2: Using Robots for App Testing

About me

Shauvik Roy Choudhary

PhD from Georgia TechFounder, MoQuality

http://shauvik.com

PhD Thesis: Cross-platform Testing & Maintenance of Web & Mobile Apps

Industry:Google, Yahoo!, FullStory, Fujitsu Labs, IBM Research, HSBC, Goldman Sachs

Entrepreneurship:Georgia Tech TI:GER program, VentureLab, ATDC, NSF SBIR

Page 3: Using Robots for App Testing

2015 IEEE International Conference on Automated Software Engineering

Page 4: Using Robots for App Testing

Test Structure

Setup

Teardown

Exercise

Verify

Page 5: Using Robots for App Testing

Testing using a Robot

Setup

Teardown

Exercise

Verify

start the app

stop the app

app shall not crash

Inputs ???

Page 6: Using Robots for App Testing

Android Monkey Tool

Page 7: Using Robots for App Testing

$ adb shell monkey -p <your.package.name> -v <number of events>

Page 8: Using Robots for App Testing

Useful Monkey Options

-s <seed>

--throttle <milliseconds>

--pct-<event_type> <percent>

--ignore-<issue>

Page 9: Using Robots for App Testing

Automated Test Input Generation Techniques

DynodroidFSE’13

A3EOOPSLA’13

SwiftHandOOPSLA’13

DroidFuzzerMoMM’13

OrbitFASE’13

Monkey2008

ACTEveFSE’12

GUIRipperASE’12

JPF-AndroidSENotes’12

PUMAMobisys’14

EvoDroidFSE’14

Null IntentFuzzerWODA’14

IntentFuzzer2009

Push button techniques

SapienzISSTA’16

TrimDroidICSE’16

Page 10: Using Robots for App Testing

Goal of Testing:

1. Make the app crash

2. Test different behaviors

Page 11: Using Robots for App Testing

Tools Strategies

1. Instrumentation strategy -- App/Platform

2. Events generation strategy -- UI/System

3. Testing strategy -- Black-box/White-box

4. Exploration strategy -- Random/Model-based/Systematic

Page 12: Using Robots for App Testing

Exploration Strategy

Page 13: Using Robots for App Testing

1. Random Exploration Strategy

Randomly selects an event for explorationTools: Monkey, Dynodroid

Advantages● Efficiently generates events● Suitable for stress testing

Drawbacks● Hardly generates specific inputs● App behavior/coverage agnostic

○ might generate redundant events

● Typically no stopping criterion

Page 14: Using Robots for App Testing

2. Model-based Exploration Strategy

Use GUI Model of the app to systematically exploreTypically FSMs (states = Activities, edges = Events)

Tools: A3E, SwiftHand, GUIRipper, PUMA, Orbit

Advantages● Intuitively more effective● Can reduce redundant events

Drawbacks ● Does not consider events that alter

non-GUI state

Page 15: Using Robots for App Testing

3. Systematic Exploration Strategy

Use sophisticated techniques (e.g., symbolic execution & evolutionary algorithms) to systematically explore the app

Tool: ACTEve and EvoDroid

Advantages● Can explore behavior that is

hard to reach by random techniques

Drawbacks ● Less scalable compared to other techniques

(xleft

< $x < xright

) ∧ (y

top < $y < y

bottom)

SAT Solver

$x = 5; $y = 10

Page 16: Using Robots for App Testing

Automated Test Input Generation Techniques

Name Doesn’t needInstrumentation

Events Exploration Strategy

Testing Strategy

Platform App UI System

Monkey ✔ ✔ ✔ ✖ Random Black-box

ACTEve ✖ ✖ ✔ ✔ Systematic White-box

Dynodroid ✖ ✔ ✔ ✔ Random Black-box

A3E-DF ✔ ✖ ✔ ✖ Model-based Black-box

SwiftHand ✔ ✖ ✔ ✖ Model-based Black-box

GUIRipper ✔ ✖ ✔ ✖ Model-based Black-box

PUMA ✔ ✔ ✔ ✖ Model-based Black-box

Page 17: Using Robots for App Testing

ExperimentsImage Credit: Daily Alchemy

Page 18: Using Robots for App Testing

Research Criteria

C1. Ease of use

C2. Android framework compatibility

C3. Code coverage achieved

C4. Fault detection ability

Page 19: Using Robots for App Testing

Mobile App Benchmarks

Combination of all subjects (68) used from F-Droid and other open source repos

Page 20: Using Robots for App Testing

Experimental Setup

Debian Host

Ubuntu Guest 2 cores6GB RAM

VirtualBox Vagrant

Android Emulators4GB RAM

Emulators: v2.3 (Gingerbread)v4.1 (Jelly Bean)v4.4 (KitKat)

Tools installed on guest:

● Removed default timeouts

● Default config; No special tuning

Page 21: Using Robots for App Testing

Experimental Protocol

● Run each tool for 1 hour on each benchmark● Repeat 10 times to account for non-deterministic behavior● Collect Results

○ Coverage Report (every 5 min)

○ Logcat -> Extracted Failures

Emma HTML Reports Parse and extract statement coverage

Logcat Parse and extract unique stack traces (RegEx)

Page 22: Using Robots for App Testing

ResultsImage Credit: ToTheWeb

Page 23: Using Robots for App Testing

C1. Ease of Use & C2. Android CompatibilityName Ease of Use Compatibility

OS Emulator/Device

Monkey NO_EFFORT Any Any

ACTEve MAJOR_EFFORT v2.3 Emu (Custom)

Dynodroid NO_EFFORT v2.3 Emu (Custom)

A3E-Depth-first LITTLE_EFFORT Any Any

SwiftHand MAJOR_EFFORT v4.1+ Any

GUIRipper MAJOR_EFFORT Any Emulator

PUMA LITTLE_EFFORT v4.3+ Any

Page 24: Using Robots for App Testing

C3. Overall Code Coverage Achieved

Page 25: Using Robots for App Testing

C3. Coverage Analysis by Benchmark App

Divide And Conquer

RandomMusicPlayer

k9mail PasswordMakerPro

...

#A

pplic

atio

ns

% Coverage

Page 26: Using Robots for App Testing

C3. Code Coverage Achieved Over Time

Page 27: Using Robots for App Testing

C4. Fault Detection Ability

Page 28: Using Robots for App Testing

Pairwise Comparison: Coverage and Failures

Cov

erag

e

Page 29: Using Robots for App Testing

Pairwise Comparison: Coverage and Failures

Failu

res

Page 30: Using Robots for App Testing

Pairwise Comparison: Coverage and Failures Coverage

Failu

res

Page 31: Using Robots for App Testing

Observations and Discussion

Page 32: Using Robots for App Testing

1.Random testing can be effective

(somehow surprisingly)

Page 33: Using Robots for App Testing

2.Strategy makes

a difference(in the behaviors covered)

Page 34: Using Robots for App Testing

3.System events

matter(in addition to UI events)

Broadcast Receiver

Intents

SMS

Notifications

Page 35: Using Robots for App Testing

4.Restarts should be minimized

(for efficient exploration)

Page 36: Using Robots for App Testing

5.Practical

considerations matter

(for practical usefulness)

Page 37: Using Robots for App Testing

5.1Practical

considerations matter

(for practical usefulness)

Manual Inputs

Page 38: Using Robots for App Testing

5.2Practical

considerations matter

(for practical usefulness)

Initial State

Page 39: Using Robots for App Testing

Open Issues for Future workImage Credits: Back to the Future (Universal Pictures)

Page 40: Using Robots for App Testing

1.Reproducibility

(allow for reproducingobserved behaviors)

Image Source: http://ncp-e.com

Page 41: Using Robots for App Testing

2.Mocking

andSandboxing

(support reproducibility, avoid side effects, ease testing)

Source: http://googletesting.blogspot.com

Page 42: Using Robots for App Testing

3.Find problems

across platforms(address fragmentation)

Image Credit: OpenSignal

Page 43: Using Robots for App Testing

Takeaway

● Random approaches can be a good start to automated testing

● No single strategy alone is effective enough to cover all behaviors=> A combination is more effective

● Use our test infrastructure:

https://moquality.com/robots

coming soon

Page 44: Using Robots for App Testing

USING ROBOTS FOR ANDROID APP TESTING

Shauvik Roy ChoudharyPhD, Georgia TechFounder, MoQuality

@shauvikhttp://shauvik.comhttp://moquality.com


Recommended