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
46
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
46
Kotlin Coroutines (Hands-On)
jabeznzomo99
0
27
Introduction to Kotlin (Hands On)
jabeznzomo99
0
110
Android MVVM Architecture
jabeznzomo99
0
41
Kotlin Coroutines: Google IO Extended 2019 Nairobi
jabeznzomo99
0
24
Other Decks in Programming
See All in Programming
抽象化という思考のツール - 理解と活用 - / Abstraction-as-a-Tool-for-Thinking
shin1x1
1
910
Claude Code と OpenAI o3 で メタデータ情報を作る
laket
0
100
Advanced Micro Frontends: Multi Version/ Framework Scenarios
manfredsteyer
PRO
0
130
Go製CLIツールをnpmで配布するには
syumai
2
1k
No Install CMS戦略 〜 5年先を見据えたフロントエンド開発を考える / no_install_cms
rdlabo
0
410
オンコール⼊⾨〜ページャーが鳴る前に、あなたが備えられること〜 / Before The Pager Rings
yktakaha4
2
1.2k
DynamoDBは怖くない!〜テーブル設計の勘所とテスト戦略〜
hyamazaki
0
160
DataformでPythonする / dataform-de-python
snhryt
0
130
Jakarta EE Meets AI
ivargrimstad
0
540
Android 15以上でPDFのテキスト検索を爆速開発!
tonionagauzzi
0
180
階層化自動テストで開発に機動力を
ickx
1
460
可変性を制する設計: 構造と振る舞いから考える概念モデリングとその実装
a_suenami
10
1.4k
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
25
1.8k
Code Review Best Practice
trishagee
69
19k
Typedesign – Prime Four
hannesfritz
42
2.7k
A designer walks into a library…
pauljervisheath
207
24k
Making Projects Easy
brettharned
117
6.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
21
1.4k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Done Done
chrislema
185
16k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
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