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
ノハナ ノ テスト ノ ハナシ
Search
HiroYUKI Seto
May 10, 2017
Technology
1
2k
ノハナ ノ テスト ノ ハナシ
2017/5/10
Android Testing Bootcamp #6
HiroYUKI Seto
May 10, 2017
Tweet
Share
More Decks by HiroYUKI Seto
See All by HiroYUKI Seto
Androidアプリの 安全なリファクタリングを行うパターン集
seto_hi
2
4.8k
UI TestやVisual Regression Testを コスパ良くやる
seto_hi
3
1.7k
事業支援というお仕事
seto_hi
0
390
MDCの内部実装から学ぶ 表現力の高いViewの作り方
seto_hi
5
1.6k
CoordinatorLayoutのBehaviorを使い倒す
seto_hi
1
300
Jetpack Compose
seto_hi
2
650
UI改善に繋がるエンジニアの立ち回り
seto_hi
2
4.4k
MDCのButtonのCorner Family
seto_hi
1
140
MDCのBottomAppBarのShadowの実現方法
seto_hi
0
860
Other Decks in Technology
See All in Technology
JSON攻略法.pdf
miyakemito
8
5.1k
反実仮想機械学習とは何か
usaito
PRO
11
4.7k
KubeCon EU 2024 Recap “Kubernetes Policy Time Machine: Where to Next?”
ryysud
0
220
非同期推論システムによるコスト削減と信頼性向上
koki_nishihara
0
260
アクセス制御にまつわる改善 / Improving access control
itkq
0
550
LLM開発・活用の舞台裏@2024.04.25
yushin_n
1
370
エンジニアのキャリアをちょっと楽しくする3本の軸/Three Pillars to Make an Engineer's Career More Enjoyable
kwappa
0
2.7k
Reducing Cross-Zone Egress at Spotify with Custom gRPC Load Balancing Recap
koh_naga
0
210
AOAI をきっかけに 社内の Azure 管理を見直した話
recruitengineers
PRO
1
300
VS CodeでAWSを操作しよう
smt7174
8
1.7k
IaCジェネレーターとBedrockで詳細設計書を生成してみた
tsukasa_ishimaru
2
280
家族アルバム みてねにおけるGrafana活用術 / Grafana Meetup Japan Vol.1 LT
isaoshimizu
1
780
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
Making the Leap to Tech Lead
cromwellryan
124
8.5k
The Invisible Side of Design
smashingmag
294
49k
Adopting Sorbet at Scale
ufuk
68
8.6k
Rails Girls Zürich Keynote
gr2m
91
13k
Creatively Recalculating Your Daily Design Routine
revolveconf
210
11k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
Building Your Own Lightsaber
phodgson
99
5.7k
RailsConf 2023
tenderlove
4
540
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
244
20k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.1k
Transcript
ノハナ ノ テスト ノ ハナシ Android Testing Bootcamp #6 株式会社ノハナ
瀬戸優之 @seto_hi
None
自己紹介 • 瀬戸優之 せとひろゆき @seto_hi • 株式会社ノハナ ◦ 唯一のAndroidエンジニア ◦
UIデザインもやる、施策も考える、なんでもやる ◦ 絶賛採用中 • 好きなAPIはCanvas#saveとViewGroup#layout
ノハナのテスト事情 • 100% Kotlin! • Unit test >>> Instrumented Test
◦ Unit testはenumが中心 ◦ Instrumented Test は古いテストが多め • CIはTravisを利用 • UIテストなし ◦ QAで保証
ノハナのテスト環境(3月) • PR投げるとTravis CIがまわる ◦ Instrumented Test + Unit test
◦ 1回15〜20分 • テストが通らないとPRをマージしない厳密なルール ◦ 毎回PRが20分待ち.. • 遅すぎる • Instrumented Test 遅すぎる
Travis Cron Jobs • Beta Feature • 特定ブランチのスクリプトを定期実行してくれる ◦ 毎日、毎週、毎月の3パターン
• PRと別のコマンドを実行できる
Travis Cron Jobs
ノハナのテスト環境(4月) • PR投げるとTravis CIがまわる ◦ Unit testのみ ◦ 1回5分 •
Travis Cron Jobsで毎日Instrumented Testが走る ◦ 1回18〜22分 • 待ち時間大幅削減
None
Robolectric Custom Shadow
Robolectric Custom Shadow • Shadow = 実行時のクラス差し替え • staticメソッドでもmockできる •
Custom Shadowの作り方が簡単になっていた • http://robolectric.org/custom-shadows/
Robolectric Custom Shadow 作り方 1. @implements{Hoge.class}をつけたクラスを作る
Robolectric Custom Shadow 作り方 2. @Implementationをつけたメソッドを作る
Robolectric Custom Shadow 作り方 3. テストクラスに@Config(shadows={ShadowHoge.class}) をつける
None
まとめ • テストの重み付けをしよう ◦ 軽いテスト、重要なテストは毎回実行 ◦ 重いテスト、重要でないテストは定期実行 ▪ Travis Cron
Jobs便利 • RobolectricのCustom Shadowはサクッと作れる ◦ staticメソッドもmockできる