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
はじめての Go * WASM *OCR
sgash708
1
100
AIプログラミング雑キャッチアップ
yuheinakasaka
17
4.2k
Generating OpenAPI schema from serializers throughout the Rails stack - Kyobashi.rb #5
envek
1
380
『テスト書いた方が開発が早いじゃん』を解き明かす #phpcon_nagoya
o0h
PRO
8
2.4k
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
890
Datadog DBMでなにができる? JDDUG Meetup#7
nealle
0
140
ML.NETで始める機械学習
ymd65536
0
230
SwiftUI Viewの責務分離
elmetal
PRO
2
270
color-scheme: light dark; を完全に理解する
uhyo
7
490
バッチを作らなきゃとなったときに考えること
irof
2
520
15分で学ぶDuckDBの可愛い使い方 DuckDBの最近の更新
notrogue
3
500
メンテが命: PHPフレームワークのコンテナ化とアップグレード戦略
shunta27
0
300
Featured
See All Featured
Designing Experiences People Love
moore
140
23k
How STYLIGHT went responsive
nonsquared
98
5.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
GitHub's CSS Performance
jonrohan
1030
460k
What's in a price? How to price your products and services
michaelherold
244
12k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Unsuck your backbone
ammeep
669
57k
Automating Front-end Workflow
addyosmani
1368
200k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
100
18k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
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ςετΛ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠