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
550
cookpad-summer-internship-2020-android
ksfee684
0
8.1k
cookpad.apk#5
ksfee684
0
620
cookpad.apk#4
ksfee684
0
690
Testing in weekly release
ksfee684
0
830
UI テストで楽するための技術
ksfee684
0
490
Espresso Driver を用いた Appium テストとその仕組み
ksfee684
0
6.8k
Other Decks in Technology
See All in Technology
Connect 100+を支える技術
kanyamaguc
0
200
ビズリーチが挑む メトリクスを活用した技術的負債の解消 / dev-productivity-con2025
visional_engineering_and_design
3
7.5k
United Airlines Customer Service– Call 1-833-341-3142 Now!
airhelp
0
170
Claude Code に プロジェクト管理やらせたみた
unson
6
3.9k
How Do I Contact HP Printer Support? [Full 2025 Guide for U.S. Businesses]
harrry1211
0
120
いつの間にか入れ替わってる!?新しいAWS Security Hubとは?
cmusudakeisuke
0
120
What’s new in Android development tools
yanzm
0
310
ビギナーであり続ける/beginning
ikuodanaka
3
750
KiCadでPad on Viaの基板作ってみた
iotengineer22
0
300
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
2
7.7k
Operating Operator
shhnjk
1
580
ビズリーチにおけるリアーキテクティング実践事例 / JJUG CCC 2025 Spring
visional_engineering_and_design
1
120
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Statistics for Hackers
jakevdp
799
220k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
BBQ
matthewcrist
89
9.7k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
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 がうまく動かない •スタックトレースがわかりにくい