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
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
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
A Guide to Unit Testing Architecture Components
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Android Maestro
August 09, 2019
Programming
65
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
A Guide to Unit Testing Architecture Components
Android Maestro
August 09, 2019
Transcript
22 slides
A Guide to Unit Testing Architecture Components
HELLO! I am Jabez Magomere (Mc JB) Android Developer and
Student (CS) 2 https://github.com/JabezNzomo99 @mc_jayb
3 Why Test? Testing is a good software practice that
helps level-up a team’s and an individual’s productivity and efficiency.
4 Why Test? Prevent unforeseen bugs in an application by
testing for all extreme use cases.
5 Get notified of any changes that breaks code (CI/CD)
Why Test?
6 Why Test? To write beautiful and clean code.
7 TESTING MYTHS
8 TESTING SLOWS DOWN DEVELOPMENT
9 TESTING IS HARD
10 TEST CODE IS NOT PRODUCTION CODE
11 Factors to consider when writing tests • Scope •
Fidelity • Speed
12
13 Architecture Components • LiveData • Room • View Model
• Data binding • Life Cycle • Navigation
14
15 Unit Testing Room
16 Unit Testing Room Testing points Test the behaviour your
database query functions in the DAOs. Insert, Delete, Get. etc
17 Unit Testing Room Testing Tools Room.inMemoryDatabase Builder() AndroidX Test
Robolectric 4.0 Hamcrest/Assert J
18 Unit Testing LiveData
19 Unit Testing LiveData Testing Tools Room.inMemoryDatabaseBuilder() AndroidX Test Robolectric
4.0 MockK/Mockito Hamcrest/Assert J Junit4/Junit5
20 Unit Testing View Model
21 Additional Resources 1. https://developer.android.com/training/testing/set-up-proje ct 2. https://medium.com/@boonkeat/android-unit-testing-with-j unit5-d1b8f9c620b6?source=email-444c006a35b8-1565059 737888-digest.reader------0-58------------------8bc853b8_1882_45
2b_ac63_879f881bb444-1§ionName=top
THANKS! Any questions? 22
More Decks by Android Maestro
See All by Android Maestro
Easy Backends for Android Developers with Ktor
jabeznzomo99
1
68
Kotlin Coroutines (Hands-On)
jabeznzomo99
0
58
Introduction to Kotlin (Hands On)
jabeznzomo99
0
150
Android MVVM Architecture
jabeznzomo99
0
72
Kotlin Coroutines: Google IO Extended 2019 Nairobi
jabeznzomo99
0
43
Other Decks in Programming
See All in Programming
imagewebp()の向こう側: WebPはなぜ JPEG・PNGより軽いのか
yuzneri
0
130
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
私なりのハーネスエンジニアリング ~独自の言語処理系の開発を通して~
seosoft
0
210
AI-Powered Domain-Driven Design
ziobrando
0
460
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.4k
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
650
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
300
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
270
SODA - FACT BOOK(EN)
sodainc
1
260
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
250
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
110
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
210
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Automating Front-end Workflow
addyosmani
1370
210k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
560
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
300
Joys of Absence: A Defence of Solitary Play
codingconduct
1
580
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
430
The untapped power of vector embeddings
frankvandijk
2
2k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k