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
36
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
10
스페셜리스트, 제너럴리스트 (모든 것이 변하는 개발시장에서 살아남는 법)
woollim
0
110
[Review] Floor noise project in Sullivan
woollim
0
93
[No4] Floor noise project in Sullivan
woollim
0
160
[No1] Floor noise project in Sullivan
woollim
0
62
Other Decks in Programming
See All in Programming
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
220
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
160
PipeCDのプラグイン化で目指すところ
warashi
1
250
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
130
WindowInsetsだってテストしたい
ryunen344
1
230
5つのアンチパターンから学ぶLT設計
narihara
1
150
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
260
都市をデータで見るってこういうこと PLATEAU属性情報入門
nokonoko1203
1
590
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
470
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
710
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
500
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
600
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1031
460k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
730
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
BBQ
matthewcrist
89
9.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Facilitating Awesome Meetings
lara
54
6.4k
A Tale of Four Properties
chriscoyier
160
23k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Fireside Chat
paigeccino
37
3.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Producing Creativity
orderedlist
PRO
346
40k
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