fight back android fragmentation
Post on 19-May-2015
2.328 Views
Preview:
DESCRIPTION
TRANSCRIPT
Fight back platform fragmentation!
Best practices in UI testing automation.
Roman Kierzkowski
Bitbar www.bitbar.com
Agenda
1. Platform fragmentation
2. Gravity & Monkey
3. Monkeyrunner
4. Android Instrumentation
5. Robotium
6. Testdroid Recorder
7. Testdroid Cloud
What is platform fragmentation?
Other platforms?
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
In numbers...
● 13 OS Versions
● Over 800 different models
● Over 300 million Android devices had been activated
● 850 000 activations daily!!!
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%
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%
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
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
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)
Robotium Pros & Cons
● Simplifies UI Instrumentation
● UI component aware
● Integrates with JUnit lifecycle
● Open source
● No screenshots logic
● Runs only within single application
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
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
top related