Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Dividing Model into layers and implementing Uni...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
kamui_project
February 26, 2019
Programming
1.3k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Dividing Model into layers and implementing Unit Test
kamui_project
February 26, 2019
Transcript
29 slides
ModelΛ LayerͰ͚ͯ Unit Testͷ؍Λ໌֬͢Δ potatotips #59
About me • Name: ͔Ή͍ (Twitter: @kamui_project) • Company: DMM.com
• App: MENUS • Community: ϖϯΪϯଜ
None
None
I will tell you …
Unit Tests for iOS
None
None
We implemented unit testing like this …
HogeTests Hoge
Architecture • GUI Architecture -> MVVM • System Architecture ->
Layered Architecture
Testability! RxSwift! DDD! CI/CD! Availability! Readability! Maintainability! Scalability! XcodeGen! All
Swift!
EoT(Ease of Testing)! RxSwift! DDD! CI/CD! Availability! Readability! Maintainability! Scalability!
XcodeGen! All Swift!
Layered Architecture IUUQTMJUUMFIBOETIBUFOBCMPHDPNFOUSZEEEBSDIJUFDUVSF Ҿ༻৽ଔʹΘΔυϝΠϯۦಈઃܭͷΞʔΩςΫνϟઆ໌<%%%>
Layer • Presentation: ViewModel • Domain: Service • UseCase: UseCase
• Infrastructure: Repository
Layer • Presentation: ViewModel • Domain: Service • UseCase: UseCase
• Infrastructure: Repository Tests Tests Tests Tests
Code Example - User Information -
UserViewModel ը໘ϩʔυ࣌ʹ6TFSใΛऔಘ͠ը໘ʹ6TSFใΛ͢ GVODVTFS8JUI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JM ^ ^
Conclusion • Before: Point of view? • After: ɹArchitcture-pattern ->
Modeling -> Carify Responsibility ->
In the end • We’re Hiring!!! -> Especially, Developer! •
Firstly… Let’s have lunch together!
Thank you!
More Decks by kamui_project
See All by kamui_project
String Catalog
tony1224
1
2.6k
DI整備でneedleを使った話
tony1224
0
350
meetup_201910.pdf
tony1224
0
180
potatotips_201906.pdf
tony1224
0
100
potatotips_201905.pdf
tony1224
1
510
andfactory_201903.pdf
tony1224
0
1.3k
WWDC18 cherry-pick Xcode 10 beta
tony1224
0
360
Other Decks in Programming
See All in Programming
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
2k
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
370
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
230
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
190
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
210
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
240
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
180
AmebaブログはKMPから卒業します
kmars0605
0
340
小さなアプリを作って公開するまで
onozaty
0
170
ActionController meets Protocol Buffers
sorah
1
800
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
学びを記事・スライド・Xへ高速展開する― AI-assisted Learning Loopで回すコンテンツ生成術
ochtum
0
210
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
69k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
980
The Pragmatic Product Professional
lauravandoore
37
7.5k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.4k
Paper Plane
katiecoart
PRO
6
55k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
630
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
610