Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[Jana Moudra] Hands-on with UI testing for Andr...
Search
Google Developers Group Lviv
September 09, 2016
Technology
0
110
[Jana Moudra] Hands-on with UI testing for Android developers
Presentation from GDG DevFest Ukraine 2016.
Learn more at:
https://devfest.gdg.org.ua
Google Developers Group Lviv
September 09, 2016
Tweet
Share
More Decks by Google Developers Group Lviv
See All by Google Developers Group Lviv
[Elad Bezalel] Angular Material CDK
gdglviv
0
150
[Zac Sweers] Breaking the Android ClassLoader
gdglviv
0
230
[Daniel Galpin] Adventures in Navigation
gdglviv
1
480
[Rebecca Franks] Practical Image Processing in Android
gdglviv
0
390
[Mateusz Herych] Architecture for App Bundles
gdglviv
1
130
[Andrea Falcone] Iterative Mobile Development
gdglviv
1
97
[Yonatan Levin] Keynote: The world of change and your significance in it
gdglviv
0
140
[Denys Tkalich] Using BigQuery as a data warehouse in B2B startup
gdglviv
0
96
[Mete Atamel] Google Assistant powered by Containers, Machine Learning and .NET on Google Cloud
gdglviv
0
150
Other Decks in Technology
See All in Technology
Amazon S3標準/ S3 Tables/S3 Express One Zoneを使ったログ分析
shigeruoda
5
590
Should Our Project Join the CNCF? (Japanese Recap)
whywaita
PRO
0
290
Lambda Web Adapterについて自分なりに理解してみた
smt7174
5
140
無意味な開発生産性の議論から抜け出すための予兆検知とお金とAI
i35_267
0
880
250627 関西Ruby会議08 前夜祭 RejectKaigi「DJ on Ruby Ver.0.1」
msykd
PRO
2
370
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
3
940
GitHub Copilot の概要
tomokusaba
1
150
ネットワーク保護はどう変わるのか?re:Inforce 2025最新アップデート解説
tokushun
0
150
Oracle Cloud Infrastructure:2025年6月度サービス・アップデート
oracle4engineer
PRO
2
310
LangChain Interrupt & LangChain Ambassadors meetingレポート
os1ma
2
220
5min GuardDuty Extended Threat Detection EKS
takakuni
0
180
タイミーのデータモデリング事例と今後のチャレンジ
ttccddtoki
4
1.3k
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Speed Design
sergeychernyshev
32
1k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
5
230
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
The Invisible Side of Design
smashingmag
300
51k
Writing Fast Ruby
sferik
628
62k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
A better future with KSS
kneath
239
17k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Transcript
UI TESTING for Android Developers Jana Moudrá @Janamou +JanaMoudra
Eh, tests?
Motivation
I tested the app myself...
Not repeatable Time consuming Error-prone Manual Testing
WE WANT TO AUTOMATE
UI testing lets you ensure that your app meets its
functional requirements and achieves a high standard of quality... Source: developer.android.com/training/testing/ui-testing/index.html
ANDROID!
UI Automator vs Espresso Simulates user interactions UI Testing on
Android
src/androidTest/java folder JUnit 4 tests Runs on same device as
app Android tests how to
UI AUTOMATOR
For many apps System apps No app source code Interacts
with visible elements UI Automator
Android 4.3 (18) or higher Works with AndroidJUnitRunner UI Automator
requirements
android { defaultConfig { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } } UI Automator
setup build.gradle
dependencies { androidTestCompile 'com.android.support.test:runner:0.5' androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' } UI Automator setup
build.gradle
android:contentDescription for ImageView etc. android:hint for EditText UI Automator accessibility
UI Automator Viewer <android-sdk>/tools/
assertEquals(hiButton.getText(), "Hi"); UI Automator asserts
UiDevice UiSelector UiObject UiCollection UiScrollable Configurator UI Automator API
ESPRESSO
For a single app Not for system apps App source
code Espresso
Android 2.2 (8) or higher Works with AndroidJUnitRunner Espresso requirements
android { defaultConfig { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } } Espresso setup
build.gradle
dependencies { androidTestCompile 'com.android.support.test:runner:0.5' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' } Espresso setup build.gradle
For Settings/Developer Options: Window animation scale Transition animation scale Animator
duration scale Turn off Animations
ActivityTestRule ViewMatchers ViewActions ViewAssertions Espresso API
Espresso Intents - extension for validation and mocking of Intents
Espresso Contrib - additional features for great tests (RecyclerView) Even more Espresso
WHICH SHOULD I USE?
Black box vs White box Multiple apps vs Single app
Without source code vs With source code UI Automator vs Espresso
Use gestures Retrieve attributes Set text No manipulation What can
I do with UI tests?
Monkey Espresso Test Recorder Firebase Test Lab Other tools
Robolectric Appium Calabash Selendroid Other libraries
NO MORE UNTESTED APPS! Jana Moudrá @Janamou +JanaMoudra
UI TESTING WORKSHOP Jana Moudrá @Janamou +JanaMoudra
1. UI Automator 2. Espresso 3. Test recorder 4. Monkey
Workshop summary
github.com/Janamou/android-testing-codelab Repository
None
• reynermedia, cc, https://www.flickr.com/photos/89228431@N06/1128559 2553/ Image credits