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.3k
Viewのテストどうしてますか?
Daiki Katayama
April 16, 2019
Tweet
Share
More Decks by Daiki Katayama
See All by Daiki Katayama
iOSアプリのパフォーマンス計測をおさらいする
kariad
1
8.3k
アプリのパフォーマンスを継続的に計測する
kariad
6
14k
Xcodeのカバレッジ計測ではなぜブランチカバレッジが取れないのだろうか?
kariad
3
3.9k
WACATE2019_summer_BPP
kariad
1
2.1k
コードカバレッジとの付き合い方を知ってテストを書く
kariad
2
2.3k
開発者として学ぶソフトウェアテスト
kariad
2
880
Other Decks in Programming
See All in Programming
Elm 0.19.0 Changes
bkuhlmann
0
480
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.6k
PostmanでAPIの動作確認が楽になった話
h455h1
0
110
ログラスを支える設計標準について / loglass-design-standards
urmot
10
2.1k
受託開発でGitLab CI を活用していく
xiombatsg
1
260
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
180
今の SmartHR にエンジニアで入社するとどうなるの?
daisukeshinoku
5
4.6k
puregoの活用例
aethiopicuschan
0
220
デザインシステムで Tailwind CSSとCSS in JSに分散投資をしたら良かった話
fsubal
18
4.8k
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
260
本格ローグライク制作にEbitengineを選んでみた
nagainaganawa
0
290
Git Lint
bkuhlmann
4
740
Featured
See All Featured
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
8
8.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
353
18k
A Philosophy of Restraint
colly
195
16k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
185
16k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
[RailsConf 2023] Rails as a piece of cake
palkan
22
3.9k
Unsuck your backbone
ammeep
662
57k
Designing on Purpose - Digital PM Summit 2013
jponch
110
6.4k
Documentation Writing (for coders)
carmenintech
59
3.9k
How to train your dragon (web standard)
notwaldorf
71
5.1k
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ςετΛ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠