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
Android における UI テスト設計戦略
Search
Kyohei Kato
February 20, 2019
Technology
2
1.1k
Android における UI テスト設計戦略
Kyohei Kato
February 20, 2019
Tweet
Share
More Decks by Kyohei Kato
See All by Kyohei Kato
After Party DroidKaigi 2021
ksfee684
0
580
cookpad-summer-internship-2020-android
ksfee684
0
8.2k
cookpad.apk#5
ksfee684
0
660
cookpad.apk#4
ksfee684
0
710
Testing in weekly release
ksfee684
0
860
UI テストで楽するための技術
ksfee684
0
510
Espresso Driver を用いた Appium テストとその仕組み
ksfee684
0
6.8k
Other Decks in Technology
See All in Technology
Eight Engineering Unit 紹介資料
sansan33
PRO
0
6.3k
旬のブリと旬の技術で楽しむ AI エージェント設計開発レシピ
chack411
1
290
Hardware/Software Co-design: Motivations and reflections with respect to security
bcantrill
1
170
ALB「証明書上限問題」からの脱却
nishiokashinji
0
220
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
ソフトとハード両方いけるデータ人材の育て方
waiwai2111
1
490
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
12k
Qiita Bash アドカレ LT #1
okaru
0
190
20260114_データ横丁 新年LT大会:2026年の抱負
taromatsui_cccmkhd
0
320
歴史から学ぶ、Goのメモリ管理基礎
logica0419
14
2.9k
AI Agent Standards and Protocols: a Walkthrough of MCP, A2A, and more...
glaforge
0
380
Vivre en Bitcoin : le tutoriel que votre banquier ne veut pas que vous voyiez
rlifchitz
0
320
Featured
See All Featured
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.8k
It's Worth the Effort
3n
188
29k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
54
49k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1.1k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
Raft: Consensus for Rubyists
vanstee
141
7.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
100
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
75
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
200
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
140
Transcript
Android における UI テスト設計戦略 Android / iOS Test Night 番外編
自己紹介 •加藤恭平(ksfee684) ‣クックパッド株式会社 技術部品質向上グループ ‣ レシピサービスアプリで UI テストなどを担当 ‣おすすめは M:tG
Android における UI テスト設計戦略
None
Kotlin を活用した いい感じの DSL による いい感じの Espresso Test
対象者 •ざっくりとした Kotlin 言語に関する知識 •ざっくりと Espresso の API に関する知識
背景 •Espresso を利用したテストを実装する環境が整ってい ない •Espresso を直に利用するのはちょっと… •テストケースをリーダブルにしつつ、裏の実装も簡単 にしたい
Robot Pattern •Jake が発表した Instrument Test 実装パターン ‣ Kotlin 言語をうまく活用
‣ https://academy.realm.io/posts/kau-jake-wharton- testing-robots/ •Page Object Pattern ライク
Robot Pattern PaymentRobot payment = new PaymentRobot(); ResultRobot result =
payment .amount(42_00) .recipient("
[email protected]
") .send(); result.isSuccess();
Robot Pattern payment { amount(4200) recipient("
[email protected]
") } send { isSuccessful()
}
もうちょっと欲張る •すべての操作に対してアサーションを挿入可能に •Kotlin の DSL に形式にもう少し従って
Kotlin を活用した いい感じの DSL による いい感じの Espresso Test
Scope Pattern
Scope Pattern •Robot Pattern を拡張 •各画面を Scope として定義 •各操作はアサーションと基本的にセット ‣
アサーションブロックを受け取る ‣ ネストするコマンドも存在している
Scope Pattern
各画面を Scope として定義
各画面を Scope として定義 •StepScope と ResultScope(e.g RecipeEditStepScope) •テストケースはシングルエントリーポイントから RootScope 下で実行される
•各 Scope(画面)は RootScope の拡張関数として定義 •Scope 自身をレシーバとするラムダ関数を引数として受 け取る
各画面を Scope として定義
各画面を Scope として定義
各画面を Scope として定義
操作はアサーションとセット
操作はアサーションとセット
操作はアサーションとセット
ネストする操作
ネストする操作
ネストする操作
まだまだこれから •DslMarker がうまく動かない •スタックトレースがわかりにくい