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
Clean Android Code for Unit Testing
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
York Wu
July 03, 2016
Programming
0
65
Clean Android Code for Unit Testing
GDG Kaohsiung 2016/07/03
York Wu
July 03, 2016
Tweet
Share
More Decks by York Wu
See All by York Wu
Parcerler
yorkwu0318
0
75
Other Decks in Programming
See All in Programming
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
CSC307 Lecture 06
javiergs
PRO
0
680
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
630
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
今から始めるClaude Code超入門
448jp
7
8.4k
SourceGeneratorのススメ
htkym
0
190
Basic Architectures
denyspoltorak
0
660
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
590
MUSUBIXとは
nahisaho
0
130
Patterns of Patterns
denyspoltorak
0
1.4k
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
Featured
See All Featured
Exploring anti-patterns in Rails
aemeredith
2
250
Product Roadmaps are Hard
iamctodd
PRO
55
12k
KATA
mclloyd
PRO
34
15k
BBQ
matthewcrist
89
10k
First, design no harm
axbom
PRO
2
1.1k
How to make the Groovebox
asonas
2
1.9k
A Tale of Four Properties
chriscoyier
162
24k
Claude Code のすすめ
schroneko
67
210k
Become a Pro
speakerdeck
PRO
31
5.8k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
190
Music & Morning Musume
bryan
47
7.1k
Transcript
Clean Android Code for Unit Testing York Wu 2016.07.03
Sample Project https://github.com/yorkwu0318/GDGK_Testing_Sample Unit testing PPT https://goo.gl/sTaFlm CI 環境建置 http://goo.gl/nAAfhF
CI PPT https://goo.gl/dSsMyU
Why Testing?
Testing Type Type Subtype Tool Unit Tests Local Unit Test
Junit Instrumented unit tests JVM
Testing Type Type Subtype Tool Integration Tests Components within your
app only Espresso Cross-app Components UI Automator
Testing Type Other Integration Test Unit Test
Demo 1
How to test it?
Model
Demo 2
None
None
None
None
UI Test!!
None
None
multi-thread
Fix it: register Idling Resource
None
How Testing
Hard to test code 1. Android Framework 2. Async Task
Write Testable Code 1. Dependency Injection 2. Base on MVP
Pattern (Clean Architecture)
Dependency Injection Demo3
None
build.gradle Ref Android Testing Codelab Android Architecture Blueprints
None
None
but unit testing..
we need better architecture • MVC • MVP • MVVM
(Databinding)
MVC C M V logic Activty LoginModel Activty, View
MVC C Activty M LoginModel V Activty, View logic Activity
and logic can’t be divided
MVP P LoginPresenter M LoginModel V Activty, View logic
MVP P LoginPresenter M LoginModel V Activty, View logic
None
None
Demo4 - MVP
None
MVVM VM LoginViewModel M LoginModel V Activty, View logic
Demo4 - MVVM
None
PreseterTest
Optimization • Data Binding • Retrofit 2 • RxJava
Retrofit 2 + RxJava Mock
RxJava mock prod
RxJava
DataBinding 1. remove findViewById( ) 2. remove view.setValue( ) 3.
simply ui logic 4. demo /ex
Testing Strategy • Mock data • Mock library
None
TDD 1. new request 2. add tests 3. red to
green practice: add new request on /ex ex: email/password regular email/password length
Summary 1. testing is used to protect code logic. 2.
testing is not used to test server API result!! 3. testing needs the testable code. 4. testable code needs good-designed code.
Q&A