Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
120
[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
1
160
[Zac Sweers] Breaking the Android ClassLoader
gdglviv
1
250
[Daniel Galpin] Adventures in Navigation
gdglviv
2
530
[Rebecca Franks] Practical Image Processing in Android
gdglviv
1
440
[Mateusz Herych] Architecture for App Bundles
gdglviv
2
140
[Andrea Falcone] Iterative Mobile Development
gdglviv
2
110
[Yonatan Levin] Keynote: The world of change and your significance in it
gdglviv
1
140
[Denys Tkalich] Using BigQuery as a data warehouse in B2B startup
gdglviv
1
100
[Mete Atamel] Google Assistant powered by Containers, Machine Learning and .NET on Google Cloud
gdglviv
1
160
Other Decks in Technology
See All in Technology
Active Directory 勉強会 第 6 回目 Active Directory セキュリティについて学ぶ回
eurekaberry
16
5.7k
Ryzen NPUにおけるAI Engineプログラミング
anjn
0
150
IaC を使いたくないけどポリシー管理をどうにかしたい
kazzpapa3
1
210
ブラウザ拡張のセキュリティの話 / Browser Extension Security
flatt_security
0
250
[続・営業向け 誰でも話せるOCI セールストーク] AWSよりOCIの優位性が分からない編(2025年11月21日開催)
oracle4engineer
PRO
1
220
Kill the Vibe?Architecture in the age of AI
stoth
1
160
AI/MLのマルチテナント基盤を支えるコンテナ技術
pfn
PRO
4
660
著者と読み解くAIエージェント現場導入の勘所 Lancers TechBook#2
smiyawaki0820
2
470
Claude Code はじめてガイド -1時間で学べるAI駆動開発の基本と実践-
oikon48
40
23k
"なるべくスケジューリングしない" を実現する "PreferNoSchedule" taint
superbrothers
0
130
タグ付きユニオン型を便利に使うテクニックとその注意点
uhyo
2
420
インフラ室事例集
mixi_engineers
PRO
2
200
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Become a Pro
speakerdeck
PRO
30
5.7k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Done Done
chrislema
186
16k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
A designer walks into a library…
pauljervisheath
210
24k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Balancing Empowerment & Direction
lara
5
780
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
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