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
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
530
cookpad-summer-internship-2020-android
ksfee684
0
8k
cookpad.apk#5
ksfee684
0
570
cookpad.apk#4
ksfee684
0
670
Testing in weekly release
ksfee684
0
800
UI テストで楽するための技術
ksfee684
0
460
Espresso Driver を用いた Appium テストとその仕組み
ksfee684
0
6.7k
Other Decks in Technology
See All in Technology
Platform Engineeringは自由のめまい
nwiizo
4
1.9k
明日からできる!技術的負債の返済を加速するための実践ガイド~『ホットペッパービューティー』の事例をもとに~
recruitengineers
PRO
3
100
事業継続を支える自動テストの考え方
tsuemura
0
300
関東Kaggler会LT: 人狼コンペとLLM量子化について
nejumi
3
460
The 5 Obstacles to High-Performing Teams
mdalmijn
0
270
PL900試験から学ぶ Power Platform 基礎知識講座
kumikeyy
0
110
Nekko Cloud、 これまでとこれから ~学生サークルが作る、 小さなクラウド
logica0419
2
730
Building Products in the LLM Era
ymatsuwitter
10
4.4k
リーダブルテストコード 〜メンテナンスしやすい テストコードを作成する方法を考える〜 #DevSumi #DevSumiB / Readable test code
nihonbuson
11
5.8k
High Performance PHP
cmuench
0
140
10分で紹介するAmazon Bedrock利用時のセキュリティ対策 / 10-minutes introduction to security measures when using Amazon Bedrock
hideakiaoyagi
0
170
Ask! NIKKEI RAG検索技術の深層
hotchpotch
13
2.8k
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
74
9.2k
Side Projects
sachag
452
42k
The Cult of Friendly URLs
andyhume
78
6.2k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.4k
Documentation Writing (for coders)
carmenintech
67
4.6k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
31
2.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
366
25k
Designing on Purpose - Digital PM Summit 2013
jponch
117
7.1k
Speed Design
sergeychernyshev
25
780
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
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 がうまく動かない •スタックトレースがわかりにくい