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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Google Developers Group Lviv
September 09, 2016
Technology
120
0
Share
[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
170
[Zac Sweers] Breaking the Android ClassLoader
gdglviv
1
250
[Daniel Galpin] Adventures in Navigation
gdglviv
2
580
[Rebecca Franks] Practical Image Processing in Android
gdglviv
1
470
[Mateusz Herych] Architecture for App Bundles
gdglviv
2
140
[Andrea Falcone] Iterative Mobile Development
gdglviv
2
130
[Yonatan Levin] Keynote: The world of change and your significance in it
gdglviv
1
150
[Denys Tkalich] Using BigQuery as a data warehouse in B2B startup
gdglviv
1
130
[Mete Atamel] Google Assistant powered by Containers, Machine Learning and .NET on Google Cloud
gdglviv
1
170
Other Decks in Technology
See All in Technology
「活動」は激変する。「ベース」は変わらない ~ 4つの軸で捉える_AI時代ソフトウェア開発マネジメント
sentokun
0
140
自分をひらくと次のチャレンジの敷居が下がる
sudoakiy
5
1.6k
Blue/Green Deployment を用いた PostgreSQL のメジャーバージョンアップ
kkato1
1
210
TUNA Camp 2026 京都Stage ヒューリスティックアルゴリズム入門
terryu16
0
650
【AWS】CloudTrail LakeとCloudWatch Logs Insightsの使い分け方針
tsurunosd
0
130
トイルを超えたCREは何屋になるのか
bengo4com
0
120
最大のアウトプット術は問題を作ること
ryoaccount
0
250
OpenClaw初心者向けセミナー / OpenClaw Beginner Seminar
cmhiranofumio
0
170
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
3
2.1k
20260323_データ分析基盤でGeminiを使う話
1210yuichi0
0
210
Network Firewall Proxyで 自前プロキシを消し去ることができるのか
gusandayo
0
160
Datadog で実現するセキュリティ対策 ~オブザーバビリティとセキュリティを 一緒にやると何がいいのか~
a2ush
0
180
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
110
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
We Have a Design System, Now What?
morganepeng
55
8.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
280
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
How STYLIGHT went responsive
nonsquared
100
6k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
170
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
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