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.5k
Viewのテストどうしてますか?
Daiki Katayama
April 16, 2019
Tweet
Share
More Decks by Daiki Katayama
See All by Daiki Katayama
iOSアプリのパフォーマンス計測をおさらいする
kariad
2
9k
アプリのパフォーマンスを継続的に計測する
kariad
6
16k
Xcodeのカバレッジ計測ではなぜブランチカバレッジが取れないのだろうか?
kariad
3
4.4k
WACATE2019_summer_BPP
kariad
1
2.2k
コードカバレッジとの付き合い方を知ってテストを書く
kariad
2
2.4k
開発者として学ぶソフトウェアテスト
kariad
2
980
Other Decks in Programming
See All in Programming
ABEMA iOS 大規模プロジェクトにおける段階的な技術刷新 / ABEMA iOS Technology Upgrade
akkyie
1
220
ファインディLT_ポケモン対戦の定量的分析
fufufukakaka
0
940
SwiftUI移行のためのインプレッショントラッキング基盤の構築
kokihirokawa
0
160
生成AIで加速するテスト実装 - ロリポップ for Gamersの事例と 生成AIエディタの活用
kinosuke01
0
130
Rails 1.0 のコードで学ぶ find_by* と method_missing の仕組み / Learn how find_by_* and method_missing work in Rails 1.0 code
maimux2x
1
250
iOSでQRコード生成奮闘記
ktcryomm
2
110
Honoのおもしろいミドルウェアをみてみよう
yusukebe
1
230
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
910
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.6k
Domain-Driven Design (Tutorial)
hschwentner
13
22k
はじめての Go * WASM *OCR
sgash708
1
110
データベースのオペレーターであるCloudNativePGがStatefulSetを使わない理由に迫る
nnaka2992
0
240
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
430
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Visualization
eitanlees
146
15k
Fireside Chat
paigeccino
35
3.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
How STYLIGHT went responsive
nonsquared
99
5.4k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
KATA
mclloyd
29
14k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.5k
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ςετΛ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠