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
40
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
20
스페셜리스트, 제너럴리스트 (모든 것이 변하는 개발시장에서 살아남는 법)
woollim
0
130
[Review] Floor noise project in Sullivan
woollim
0
100
[No4] Floor noise project in Sullivan
woollim
0
170
[No1] Floor noise project in Sullivan
woollim
0
65
Other Decks in Programming
See All in Programming
チームをチームにするEM
hitode909
0
440
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
330
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
510
Cell-Based Architecture
larchanjo
0
160
ローカルLLMを⽤いてコード補完を⾏う VSCode拡張機能を作ってみた
nearme_tech
PRO
0
240
ゆくKotlin くるRust
exoego
1
190
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
130
GISエンジニアから見たLINKSデータ
nokonoko1203
0
190
ゲームの物理 剛体編
fadis
0
390
愛される翻訳の秘訣
kishikawakatsumi
3
370
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
180
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
1
230
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
94
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
160
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
84
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
190
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
It's Worth the Effort
3n
187
29k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
590
Into the Great Unknown - MozCon
thekraken
40
2.2k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
From π to Pie charts
rasagy
0
100
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