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.3k
WACATE2019_summer_BPP
kariad
1
2.2k
コードカバレッジとの付き合い方を知ってテストを書く
kariad
2
2.4k
開発者として学ぶソフトウェアテスト
kariad
2
970
Other Decks in Programming
See All in Programming
密集、ドキュメントのコロケーション with AWS Lambda
satoshi256kbyte
0
180
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
490
ファインディの テックブログ爆誕までの軌跡
starfish719
2
1.1k
さいきょうのレイヤードアーキテクチャについて考えてみた
yahiru
3
730
ペアーズでの、Langfuseを中心とした評価ドリブンなリリースサイクルのご紹介
fukubaka0825
2
300
SwiftUIで単方向アーキテクチャを導入して得られた成果
takuyaosawa
0
260
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
360
Spring gRPC について / About Spring gRPC
mackey0225
0
220
Pulsar2 を雰囲気で使ってみよう
anoken
0
230
Ruby on cygwin 2025-02
fd0
0
140
Bedrock Agentsレスポンス解析によるAgentのOps
licux
2
720
Linux && Docker 研修/Linux && Docker training
forrep
23
4.5k
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
4 Signs Your Business is Dying
shpigford
182
22k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
A better future with KSS
kneath
238
17k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Six Lessons from altMBA
skipperchong
27
3.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
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ςετΛ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠