Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
650
cookpad.apk#4
ksfee684
0
710
Testing in weekly release
ksfee684
0
860
UI テストで楽するための技術
ksfee684
0
500
Espresso Driver を用いた Appium テストとその仕組み
ksfee684
0
6.8k
Other Decks in Technology
See All in Technology
Strands AgentsとNova 2 SonicでS2Sを実践してみた
yama3133
1
1.7k
Strands Agents × インタリーブ思考 で変わるAIエージェント設計 / Strands Agents x Interleaved Thinking AI Agents
takanorig
4
1.9k
さくらのクラウド開発ふりかえり2025
kazeburo
2
680
AI との良い付き合い方を僕らは誰も知らない
asei
0
230
モダンデータスタックの理想と現実の間で~1.3億人Vポイントデータ基盤の現在地とこれから~
taromatsui_cccmkhd
2
260
Lookerで実現するセキュアな外部データ提供
zozotech
PRO
0
200
特別捜査官等研修会
nomizone
0
540
202512_AIoT.pdf
iotcomjpadmin
0
130
20251203_AIxIoTビジネス共創ラボ_第4回勉強会_BP山崎.pdf
iotcomjpadmin
0
130
日本Rubyの会: これまでとこれから
snoozer05
PRO
5
230
「図面」から「法則」へ 〜メタ視点で読み解く現代のソフトウェアアーキテクチャ〜
scova0731
0
490
Amazon Quick Suite で始める手軽な AI エージェント
shimy
1
1.7k
Featured
See All Featured
A designer walks into a library…
pauljervisheath
210
24k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
290
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
710
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
0
950
New Earth Scene 8
popppiees
0
1.2k
A better future with KSS
kneath
240
18k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
37
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
160
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
850
The Pragmatic Product Professional
lauravandoore
37
7.1k
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 がうまく動かない •スタックトレースがわかりにくい