Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
[Jana Moudra] Hands-on with UI testing for Andr...
Search
Google Developers Group Lviv
September 09, 2016
Technology
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[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
More Decks by Google Developers Group Lviv
See All by Google Developers Group Lviv
[Elad Bezalel] Angular Material CDK
gdglviv
1
180
[Zac Sweers] Breaking the Android ClassLoader
gdglviv
1
270
[Daniel Galpin] Adventures in Navigation
gdglviv
2
600
[Rebecca Franks] Practical Image Processing in Android
gdglviv
1
500
[Mateusz Herych] Architecture for App Bundles
gdglviv
2
160
[Andrea Falcone] Iterative Mobile Development
gdglviv
2
150
[Yonatan Levin] Keynote: The world of change and your significance in it
gdglviv
1
170
[Denys Tkalich] Using BigQuery as a data warehouse in B2B startup
gdglviv
1
140
[Mete Atamel] Google Assistant powered by Containers, Machine Learning and .NET on Google Cloud
gdglviv
1
190
Other Decks in Technology
See All in Technology
Bet AI Day 2026丨バクラク Autopilot、業務システムの再設計
layerx
PRO
2
1.7k
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
3
210
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
140
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
130
DEFCON_CHV_CTF_Write-up.pdf
bata_24
0
110
V8コントリビュート超入門
riyaamemiya
0
160
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
120
『止めない』を設計する — 制約の中で、事業の根幹を支える判断
hiroyaterui
0
240
振り返りこそエンジニアの本領
negima
0
350
WAF 運用改善の承認サイクル/SRE_BizReach_MIXI_1
visional_engineering_and_design
2
390
Sigmaユーザーのための有用リソース一挙公開 & Sigmaで使えるMCP #sigma_ucj /useful-resources-for-sigma-computing-users-and-mcps-with-sigma
shinyaa31
0
170
Adaptive Warehouse を今すぐ導入すべき理由と迷ったときの判断基準
__allllllllez__
0
130
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
230
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Navigating Weather and Climate Data
rabernat
0
510
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
Color Theory Basics | Prateek | Gurzu
gurzu
0
460
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
How to Think Like a Performance Engineer
csswizardry
28
2.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
New Earth Scene 8
popppiees
3
2.5k
The Spectacular Lies of Maps
axbom
PRO
1
980
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
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