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
Let's write RxTesting Code
Search
Byeong Chan - Lee
November 12, 2019
Programming
0
32
Let's write RxTesting Code
RxTest와 RxBlocking을 사용하여 MVVM + RxSwift 아키텍처를 가진 앱의 테스트 코드를 작성해봅시다.
Byeong Chan - Lee
November 12, 2019
Tweet
Share
More Decks by Byeong Chan - Lee
See All by Byeong Chan - Lee
스페셜리스트, 제너럴리스트 (모든 것이 변하는 개발시장에서 살아남는 법)
woollim
0
66
[Review] Floor noise project in Sullivan
woollim
0
83
[No4] Floor noise project in Sullivan
woollim
0
140
[No1] Floor noise project in Sullivan
woollim
0
56
Other Decks in Programming
See All in Programming
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
280
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
330
fs2-io を試してたらバグを見つけて直した話
chencmd
0
280
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
140
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
600
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
880
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
960
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
860
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
270
CloudflareStack でRAGに入門
asahiiwm
0
140
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
940
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
170
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
171
50k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
490
Why Our Code Smells
bkeepers
PRO
335
57k
Six Lessons from altMBA
skipperchong
27
3.5k
Designing for humans not robots
tammielis
250
25k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Transcript
ߛ࢟۞٘ ߽ଲ 3Y5FTUэदೞӝ 3Y5FTU 3Y#MPDLJOHਸэঌইࠁӝ
ߛ࢟۞٘ ߽ଲ 3Y5FTUэदೞӝ 3Y5FTU 3Y#MPDLJOHਸэঌইࠁӝ
1. TestCode, ObservableTestCodeۆ? 2. RxBlockingী ೧ 3. RxTestী ೧ 4.
RxSwiftܳ పझ೧ࠁ! ݾର
1. TestCodeۆ?
যڃ زਸ ࣻ೯ ೮ਸ ٸ 1) ਗೞח ч աয়ח Ѩૐ
2) োࣘغযঠ ೞח ز ࣻ೯غח Ѩૐ 5FTU$PEFۆ
ਗೞחчաয়ח
ਗೞחчաয়ח
ਗೞחчաয়ח
ਗೞחчաয়ח ч ਗೞח ഋక۽ աয়ח Ѩૐ
োࣘغযঠೞחزਸࣻ೯ೞח
োࣘغযঠೞחزਸࣻ೯ೞח
োࣘغযঠೞחزਸࣻ೯ೞח
োࣘغযঠೞחزਸࣻ೯ೞח
োࣘغযঠೞחزਸࣻ೯ೞח োࣘغযঠ ೞח ز ࣻ೯ Ѩૐ
Ӓۢ Observable?
None
RxTest ࢜ղӝ "ߛ࢟"
None
None
None
Eventܳ زӝਵ۽ ߉ਸ ࣻח হਸө? subscribeহ Eventܳ ߉ਸ ࣻח হਸө?
Hot Observableੌ ٸח? reduceب ޅೞחؘ…
ӝೞח ఋ߁ী Eventо աয়ח Ѩૐ? ߡౡ ׂۥਸ ٸ Eventо աয়ח
Ѩૐ೧ঠ ೞਗ਼ই?
None
/* Eventܳ рױೞѱ ୶ೡ ࣻ যঠ ೣ /* ਗೞח ч
ਗೞח ఋ߁ী աয়ח Ѩૐ
RxBlocking RxTest যࢲ৬, పझח ?
2. RxBlocking
None
➜ [ , , , , ]
None
None
None
onCompleteо ڄয ٸө ӝܽ…
None
➜ [ , , , , ] onCompleteо ԙ ڄযઉঠ
ೣ
.toBlocking(timeout: RxTimeInterval?)
[ , , ] ➜
- ColdObservable Eventܳ Ѩૐೡ ٸ ࢎਊ - ౠ दрزউ ߑػ
Observable Eventب Ѩૐ оמ • HotObservableب ࢎਊ оמ 3Y#MPDLJOH
3. RxTest
1ୡ 2ୡ 3ୡ 4ୡ 5ୡ ➜ [ (, 1ୡ), (,
2ୡ), (, 3ୡ), (, 4ୡ), (, 5ୡ) ] ➜ 3ୡী о ա৳חо?
None
None
None
let buttonTapped = s.createHotObservable([ .next(1, Void()), .next(3, Void()) ])
ҳة ৈࠗ৬ ࢚ҙহ ߮ ߊࢤ
ҳة दغݶ ೧ ࣽࢲ۽ ߮ ߊࢤ
1ୡ 2ୡ 3ୡ 4ୡ 5ୡ ҙ ➜ ➜ [ (,
1ୡ), (, 2ୡ), (, 3ୡ), (, 4ୡ), (, 5ୡ) ]
о࢚ दр ݽف ܳ ٸө ҙ
о࢚ दр ݽف ܳ ٸө ҙ Observable ա ঋইب ࢚ҙX
о࢚ दр ݽف ܳ ٸө ҙ Hot Observableب పझ оמ!
None
None
None
о࢚ दр ݽف ܳٸө..
None
- Observableী दрѐ֛ਸ ֍যષ • ܳ ా೧ ઁ ޖ ա৳ח
Ѩૐ оמ - Observerܳ ా೧ Hot, Cold ݽف Ѩૐоמ • о࢚ दр ܳ ٸө ҙ റ ఋ߁җ Event ߈ജ 3Y5FTUח
4. RxSwiftܳ పझೞ
None
- ਗೞח ч ࢚ਵ۽ աয়ח Ѩૐ - Responseী ࢚ҙহ ࢚ೞח
Ѿҗо աয়ח JT-PBEJOH5FTU$BTF
None
None
None
None
None
None
None
✨
None
- tapped غਸ ٸ ݃ ਗೞח ч ࢚ਵ۽ աয়ח Ѩૐ
- Responseী ࢚ҙহ ࢚ೞח Ѿҗо աয়ח MPBEJOH5FTU$BTF
None
None
None
None
None
None
None
None
None
✨ ✨ ✨
- Mocking, о࢚ दр, Observer.. ઁ ߓա? - TestCodeࠁ ӝמ
ѐߊ ؊ ࢶ ইפঠ? 3Y#MPDLJOH 3Y5FTU
func removeAllData() { /* ҳഅ */ Implements() }
func removeAllData() { /* ҳഅ */ Implements() } ݅ড ઁীࢲ
־ۅػ ؘఠо ݶ?
োೞѱ زೡ Ѫ э ٘ ߓन ➜ Hotfix
TestCodeח োೠ ٘о োೞѱ زೞח Ѩૐ
RxSwift TestCodeח Observable োೞѱ ߑغח Ѩૐ
“RxSwift & పझ٘৬ ೣԋ Әਲ਼ ഄनਸ ٜ݅যт ࢎٜਸ ߛ࢟ ӝ݀פ.”
- RxTest, RxBlocking • https://www.raywenderlich.com/7408-testing-your-rxswift-code • https://github.com/ReactiveX/RxSwift/blob/master/Documentation/UnitTests.md - Nimble •
https://github.com/Quick/Nimble - Stubber • https://github.com/devxoul/Stubber ଵҊܐ
slido.com / #P445
None