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
iOSアプリ単体テスト入門
Search
Yamada Ryo
May 11, 2018
Programming
1.6k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
iOSアプリ単体テスト入門
初めて単体テストを書いてみたその手法と感想について。
Yamada Ryo
May 11, 2018
More Decks by Yamada Ryo
See All by Yamada Ryo
Apple PayとPassword AutoFillの実装方法と困った話
yamadaryo11
0
1.3k
クラスメソッドでiOSアプリ 開発をする際に使われた技術の紹介
yamadaryo11
1
760
Other Decks in Programming
See All in Programming
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.3k
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
120
3Dシーンの圧縮
fadis
1
690
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
5
3.9k
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
560
Inside Stream API
skrb
1
680
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.6k
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
350
A2UI という光を覗いてみる
satohjohn
1
130
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
150
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
2
540
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
810
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
850
Code Review Best Practice
trishagee
74
20k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.7k
How to make the Groovebox
asonas
2
2.2k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
160
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
610
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
Transcript
IOSΞϓϦ୯ମςετ ೖ ΫϥεϝιουגࣜձࣾɹϞόΠϧΞϓϦαʔϏε෦ɿɹࢁాɹྑ
ରऀ • ະͩiOSΞϓϦͰ୯ମςετΛॻ͍ͨ͜ͱͷͳ͍ਓ • ςετ͍͢͠ίʔυͷॻ͖ํ͕ྑ͘Θ͔Βͳ͍ਓ
ςʔϚΛܾΊͨܦҢ • ࢲ͕ࣗiOSΞϓϦͷ୯ମςετΛॻ͍ͨܦݧ͕ͳ͍ • ϓϩδΣΫτͰ୯ମςετΛॻ͘ػձ͕͋ͬͨ • ͜Ε͔Β୯ମςετͷཧղΛਂΊ͍͖͍ͯͨͱ͍͏Ϟν ϕʔγϣϯ
؆୯ͳࣗݾհ • iOSΞϓϦ։ൃܦݧɿ̎ • αʔόαΠυWebFrontɺΈࠐΈwindowsͷΫϥαό ͳͲ৭ʑͳҊ݅ʹབྷΜͰ͍ͨͷͰͣͬͱiOSΞϓϦ։ൃΛ ͍ͯͨ͠༁Ͱͳ͍Ͱ͢ • ݩCOBOLer
ମݧͨ͠୯ମςετͷޮՌ • ͙͢ʹޮՌΛ࣮ײͰ͖ΔͷͰͳ͍ɻ • ޙʑɺʮطଘͷϓϩμΫτίʔυΛഁյ͍ͯ͠ͳ͍͔͕Θ ͔Δʯ • ഁյ͍ͯ͠ͳ͍͜ͱ͕Θ͔ΔͨΊɺਫ਼ਆతʹ҆৺ײ͕͋Δ
ࠓճͷ୯ମςετಋೖͷൣғ • ϏδωεϩδοΫʹద༻ • UIςετʹ͍ͭͯࠓޙͷ՝ͱ͍ͯ͠Δ
ςετΛॻ͜͏ͱͯ͠ͿͪͨΔน • ΊͪΌͪ͘Όςετ͠ʹ͍͘෦͕ग़ͯ͘Δɻ • ఘΊ؊৺
ͦͦςετ͍͢͠ίʔυͱʁ • Dependency Injection(DI)͠·͢ • ґଘ͢ΔϞδϡʔϧΛ෦Ͱੜ͢ΔͷͰͳ͘ɺʮೖ ͢Δʯ
SWIFTͰDIͬͯͲ͏Δͷʁ • protocolΛ্खʹ͏ • ࣗͰॻ͍ͨΫϥεͰ͋ΕɺinitializeͰґଘؔΛೖ ͢Δ • ViewControllerʹDIͰ͖ΔϥΠϒϥϦଘࡏ͢Δ • ViewControllerผ్InjectϝιουΛ࡞ͬͯରԠͨ͠
۩ମతͳྫ.ʢϓϩμΫτʣ ViewController Presenter DataStore Viewͷૢ࡞ APIίʔϧ Viewͷඳը໋ྩ APIίʔϧ໋ྩ • ࠨͷΑ͏ͳߏ
ͷϓϩμΫτΛྫ ʹ͠·͢ɻ • ࠓճPresenter ʹߜͬͯղઆ͠· ͢
۩ମతͳྫ.ʢVIEWCONTROLLERʣ
۩ମతͳྫ.ʢDIʣ
۩ମతͳྫ.ʢPRESENTER - 1ʣ
۩ମతͳྫ.ʢPRESENTER - 2ʣ
۩ମతͳྫ.ʢMOCKʣ
None
None
None
୯ମςετ͍͢͠ϞόΠϧΞʔΩςΫνϟ • ΫϦϯΞʔΩςΫνϟ
ʮςετ͍͢͠ίʔυʯΛແࢹࣦͯ͠ഊͨ͠ྫ • KeychainΛૢ࡞͢ΔγϯάϧτϯΛ༻ͨ͠SDKΛ PresenterͰૢ࡞ͯ͠KeychainͷΛॻ͖͑ͯ͠ ·ͬͨ
SDK͕γϯάϧτϯΦϒδΣΫτΛ͍ͬͯͨ࣌ͷճආ ํ๏ • WrapperΫϥεΛ࡞ͬͯɺprotocolΛܧঝͨ͠Ϋϥεʹแ Μͩ
୯ମςετΛಋೖͨ͠ࡍͷฐ • ࣮ྔʢ࡞ۀྔʣଟ͘ͳΔ • ΠϯλʔϑΣʔε͕มΘΔ༷มߋͷࡍɺमਖ਼ྔ͕ଟ͘ͳͬ ͯਫ਼ਆతʹͭΒ͍
൪֎ฤɿ࣮APIΛୟ͘ςετΛॻ͖͔ͨͬͨ • ຖճࢼ͍ͨ͠Θ͚Ͱͳ͍͕ɺAPIʢ֎෦γεςϜʣ͕ਖ਼ ͍͠ϨεϙϯεΛฦ͍ͯ͠Δ͔ɺ࣌ʑ֬ೝ͔ͨͬͨ͠ • SchemeΛ͚ͯɺ࣮APIΛୟ͘ςετΛผ్࡞ͨ͠ • CIπʔϧʹͯ୯ମςετΛΒ͍͕ͤͯͨɺ࣮APIΛୟ͘ Schemeର֎ͱͨ͠
ݱঢ়ͷײ • Կ͔ഁյతมߋΛ͛ͨ໘͕͋ΓɺޮՌ͋ͬͨ • ॻ͖׳Ε͍ͯͳ͍ɺ࡞ۀ͕ͳ͔ͳ͔ਐ·ͳ͔ͬͨ • Ώ͘Ώ͘Test-DrivenDevelopment(TDD)Λಋೖͯ͠ςε τͰ͖ΔϓϩμΫτίʔυͷΈ͕ଘࡏ͢ΔΑ͏ʹ͍ͨ͠ʢཧ ʣ
͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠