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
A Guide to Unit Testing Architecture Components
Search
Android Maestro
August 09, 2019
Programming
0
40
A Guide to Unit Testing Architecture Components
Android Maestro
August 09, 2019
Tweet
Share
More Decks by Android Maestro
See All by Android Maestro
Easy Backends for Android Developers with Ktor
jabeznzomo99
1
35
Kotlin Coroutines (Hands-On)
jabeznzomo99
0
16
Introduction to Kotlin (Hands On)
jabeznzomo99
0
80
Android MVVM Architecture
jabeznzomo99
0
20
Kotlin Coroutines: Google IO Extended 2019 Nairobi
jabeznzomo99
0
12
Other Decks in Programming
See All in Programming
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
2
200
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
Netty Chicago Java User Group 2024-04-17
sullis
0
200
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
1k
Site Reliability Engineering for GMO
pyama86
8
1.1k
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
980
Sheets API使ってみた
toshi0383
2
160
GitHub Copilotのススメ
marcy731
1
220
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
120
Snowflakeで眠ったデータを起こそう!
estie
0
140
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
380
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
8
1.4k
Featured
See All Featured
KATA
mclloyd
16
12k
Become a Pro
speakerdeck
PRO
12
4.6k
How STYLIGHT went responsive
nonsquared
92
4.8k
The Mythical Team-Month
searls
216
42k
Into the Great Unknown - MozCon
thekraken
14
1k
Art, The Web, and Tiny UX
lynnandtonic
290
19k
It's Worth the Effort
3n
180
27k
Robots, Beer and Maslow
schacon
PRO
155
7.9k
Six Lessons from altMBA
skipperchong
22
3k
Clear Off the Table
cherdarchuk
85
310k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
26
2.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
275
13k
Transcript
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