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
Viewのテストどうしてますか?
Search
Daiki Katayama
April 16, 2019
Programming
2
1.4k
Viewのテストどうしてますか?
Daiki Katayama
April 16, 2019
Tweet
Share
More Decks by Daiki Katayama
See All by Daiki Katayama
iOSアプリのパフォーマンス計測をおさらいする
kariad
1
8.5k
アプリのパフォーマンスを継続的に計測する
kariad
6
15k
Xcodeのカバレッジ計測ではなぜブランチカバレッジが取れないのだろうか?
kariad
3
4.1k
WACATE2019_summer_BPP
kariad
1
2.1k
コードカバレッジとの付き合い方を知ってテストを書く
kariad
2
2.3k
開発者として学ぶソフトウェアテスト
kariad
2
920
Other Decks in Programming
See All in Programming
Polarsの成長: v0.14からv1.0までの変遷と今後の展望
zerebom
1
350
Clean Architecture by TypeScript & NestJS
ryounasso
0
150
GraphQL はいいぞ! ~Laravel で学ぶ GraphQL 入門~
azuki
1
160
Rustのweb開発を助ける 便利なツール紹介
yuki0418
1
190
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Berlin
prof18
0
110
ぼっちを避けて楽しむためのアノテコノテ / Various Tips and Tricks to Avoid Loneliness and Have Fun
nrslib
3
1.7k
CSC307 Lecture 14
javiergs
PRO
0
220
Trial
cairolibrary720
1
130
OpenAI/Gemini APIを使って EPUBを翻訳するCLIツールをつくってみた
tomiyan
0
790
最古の関数型言語「Lisp」ことはじめ / lisp_in_kamiyama
uhooi
1
190
Introduction to GitOps
hwchiu
0
110
Terraformテスト入門
msato
0
520
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
228
16k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
Infographics Made Easy
chrislema
238
18k
From Idea to $5000 a Month in 5 Months
shpigford
377
46k
Being A Developer After 40
akosma
72
580k
Rails Girls Zürich Keynote
gr2m
93
13k
Building Flexible Design Systems
yeseniaperezcruz
323
37k
Web development in the modern age
philhawksworth
203
10k
Gamification - CAS2011
davidbonilla
78
4.9k
Automating Front-end Workflow
addyosmani
1362
200k
Clear Off the Table
cherdarchuk
89
320k
Building Applications with DynamoDB
mza
89
5.8k
Transcript
ViewͷςετͲ͏ͯ͠·͔͢ʁ 2019/04/16 iOS Test Night #10 kariad/͔Γ͋Ͳ(@kariad_uu) 1
ࣗݾհ • kariad / @kariad_uu • ยࢁ େथ • ΦΠγοΫεɾϥɾେ
iOS App Developer • / / V / ςετ / ઃܭ / ྉཧ 2
Viewͷςετ͘͠ͳ͍Ͱ͔͢ʁ
ViewҎ֎ͷςετ • ϩδοΫঢ়ଶͷมԽͳͲ • جຊతʹUnitςετ͔ͭςετ͍͢͠
Viewͷςετ • ϨΠΞτɺViewͷ༗ແɺදࣔඇදࣔɺςΩετ, etc. • ԿΛςετ͍͔ͨ͠ɺͲ͜·Ͱςετ͍͔ͨ͠ͰͲ͏ςετ ͢Δ͖͔มΘΔ
• UIςετ • Snapshotςετ • Presenterͷςετ • ViewͷUnitςετ Unitςετ
༗໊ͳΞϨ
Presenterͷςετ • Viewͷঢ়ଶɺૢ࡞Λςετ͢Δ • ViewʹϩδοΫ͕ແ͘ɺͨͩViewΛߋ৽͢Δ͚ͩ • Viewͷ࣮ਖ਼͘͠ग़དྷ͍ͯΔͱ͍͏લఏ • ࣮ࡍʹViewΛςετ͠ͳ͍ͷͰ؆୯ɺ࣮ߦૣ͍
•ViewisHidden = falseΛ͢Δ͚ͩ •Viewͷૢ࡞Λςετ͢Δ •ViewͷςετΛॏࢹ͠ͳ͍߹࠷ݶ͜ΕͰ
ViewͷUnitςετ • ؤுͬͯViewΛUnitςετͰςετ͢Δ • ViewΛLoadͯ͠ɺViewͷ֊νΣοΫͯ͠ɺɺ • Viewͷ༗ແɺදࣔඇදࣔςΩετͳΒςετͰ͖Δ • ButtonλοϓͷΠϕϯτςετͰ͖Δ
• UIControlͰλοϓͰ͖ΔViewΛ؆୯ʹ࡞ • addTarget(_:action:for:)ͰΠϕϯτՃ • sendActions(for:)ͰΠϕϯτൃՐ
Succinct • ViewͷUnitςετΛ؆୯ʹͰ͖ΔϥΠϒϥϦ • https://github.com/derekleerock/Succinct
͜ͷը໘Λςετ͍ͨ͠ •ٻ͕ͳ͍࣌ •ʮ͝ར༻͋Γ·ͤΜʯͷUILabel •ϨϯίϯͱΦϨϯδͷUIImageView
• MVPͷPresenterʹΑΔखଓ͖ܕͷߋ৽ • ViewͷdisplaysEmptyView()ΛݺͿͱView͖ͬ͞ͷը໘Λ දࣔ͢Δ લఏ
Succinct!!
·ͱΊ • Viewͷςετ৭ʑ͋Δ͕ɺԿΛςετ͍͔ͨ͠Ͱ͔ͬ͠Γ ͍͚Δ • UnitςετͰςετͰ͖ΔͷͰ͋ΕίετͳͷͰྑ͍ • UIControlSuccinctΛͬͯΑΓศརʹViewͷUnitςετΛ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠