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
870
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
410
cookpad-summer-internship-2020-android
ksfee684
0
7.8k
cookpad.apk#5
ksfee684
0
460
cookpad.apk#4
ksfee684
0
570
Testing in weekly release
ksfee684
0
740
UI テストで楽するための技術
ksfee684
0
380
Espresso Driver を用いた Appium テストとその仕組み
ksfee684
0
6.4k
Other Decks in Technology
See All in Technology
SREsのためのSRE定着ガイド
netmarkjp
10
1.5k
業務で使えるかもしれない…!?GitHub Actions の Tips 集 / CI/CD Test Night #7
ponkio_o
PRO
22
6.7k
やっていきテスト
k6s4i53rx
0
160
Autify Company Deck
autifyhq
1
30k
HoneycombとOpenTelemetryでオブザーバビリティに入門してみる
sumiren
2
140
MongoDB Atlas Vectorsearchではじめる生成AIアプリ開発
chie8842
3
500
ビジネスとコード品質の接合点 そしてコード品質がそこに及ぼす影響 / The Intersections of Business and Engineering, and The Impact of Code Quality There
mtx2s
10
1k
本気でプロダクトに向き合うCTOになるために必要な事 (技育祭2024春)
mosa_siru
45
14k
バッチ処理のSLOをどう設計するか
rynsuke
7
540
理想の組織も自分たちで作ろう! ―LayerXの「全員採用」を支える文化 / How to create our own ideal team
ar_tama
7
2.5k
大規模なアジャイル開発の現場と技術負債 / Technical Debt
yoshiitaka
20
3.9k
学生としてRSGT2024に参加して得られた学び / Lessons learned from participating in RSGT2024 as a student
fujiemon
0
110
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
14
1.3k
Building an army of robots
kneath
300
41k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
272
12k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
113
18k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
185
15k
How GitHub (no longer) Works
holman
301
140k
Stop Working from a Prison Cell
hatefulcrawdad
265
19k
The Cult of Friendly URLs
andyhume
72
5.6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
153
14k
Why You Should Never Use an ORM
jnunemaker
PRO
50
8.6k
RailsConf 2023
tenderlove
0
510
Atom: Resistance is Futile
akmur
258
25k
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 がうまく動かない •スタックトレースがわかりにくい