fight back android fragmentation

17
Fight back platform fragmentation! Best practices in UI testing automation. Roman Kierzkowski Bitbar www.bitbar.com

Upload: bitbar

Post on 19-May-2015

2.321 views

Category:

Technology


4 download

DESCRIPTION

These are the slides for the presentation that Bitbar experts gave at Droidcon Berlin 2012 (http://de.droidcon.com/content/testing-device-compatibility-not-hard-you-think). The presentation included also a live demo of Recording tests with Testdroid Recorder 2.0 and running the same use cases with one click on all 100+ real Android devices in Testdroid Cloud.

TRANSCRIPT

Page 1: Fight back android fragmentation

Fight back platform fragmentation!

Best practices in UI testing automation.

Roman Kierzkowski

Bitbar www.bitbar.com

Page 2: Fight back android fragmentation

Agenda

1. Platform fragmentation

2. Gravity & Monkey

3. Monkeyrunner

4. Android Instrumentation

5. Robotium

6. Testdroid Recorder

7. Testdroid Cloud

Page 3: Fight back android fragmentation

What is platform fragmentation?

Page 4: Fight back android fragmentation

Other platforms?

Page 5: Fight back android fragmentation

What does fragmentation consist of?

● Android version● Screen resolution & density & diagonal● CPU speed● RAM size● GPU presence & speed● Sensors presence & accuracy● SD presence & capacity● Virtual or real keyboard● Device manufacturer● Custom UI & User preferences

Page 6: Fight back android fragmentation

In numbers...

● 13 OS Versions

● Over 800 different models

● Over 300 million Android devices had been activated

● 850 000 activations daily!!!

Page 7: Fight back android fragmentation

Platform versions

Data collected during a 14-day period ending on February 1, 2012 (http://developer.android.com/resources/dashboard/platform-versions.html)

Versions 2.1 to 2.3.7 = 94%

Page 8: Fight back android fragmentation

Screen Sizes and Denisties

Data collected during a 7-day period ending on February 1, 2012 (http://developer.android.com/resources/dashboard/screens.html)

normal mdpi + normal hdpi = 85.5%

Page 9: Fight back android fragmentation

Gravitation & Monkey

● Gravity

● UI/Application Exerciser Monkey

● Stress test application (pseudo-randrom actions)

● Runs inside emulator or device

http://developer.android.com/guide/developing/tools/monkey.html

$ adb shell monkey [options] <event-count>

$ adb shell monkey -s 333 -p your.package.name -v 500

Page 10: Fight back android fragmentation

Android Instrumentation Framework● Instrumentation allows to run components without their normal lifecycles

● Android testing is based on JUnit

● JUnit 3 lifecycle (test methods, setUp(), tearDown())

● Separate test project

● Runs inside of the device

● Instrumentation & Application APKs must be signed with the same key!

● For different components different TestCase

● For activities: ActivityInstrumentationTestCase2

● MoreAssert and ViewAsserts

Page 11: Fight back android fragmentation

Robotium

● Opensource project (http://code.google.com/p/robotium/)

● On top of Android instrumentation – great simplification

● How does Robotium recognize elements: → Texts → Visible element's indexes → X,Y

● Solo is main class. It contains various methods like: → clickOnImage(int index) → clickOnButton(String text)

→enterText(int index, java.lang.String text)

Page 12: Fight back android fragmentation

Robotium Pros & Cons

● Simplifies UI Instrumentation

● UI component aware

● Integrates with JUnit lifecycle

● Open source

● No screenshots logic

● Runs only within single application

Page 13: Fight back android fragmentation
Page 14: Fight back android fragmentation

Testdroid Recorder

● Eclipse plugin (http://www.testdroid.com/updates/)

● Records monkeyrunner & Robotium

● Record test from APK & Sources

● Introduces R.id identification

● Takes screenshots

● Scalable clicks & drags

● Split testcases into methods

Page 15: Fight back android fragmentation
Page 16: Fight back android fragmentation

Testdroid cloud

● Run tests against over 100 different real devices

● View test results

● View screenshoots in convienient way

● Use baseline feature to detect broken layouts

● View logs

● Follow your project statistics

Page 17: Fight back android fragmentation