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
uiautomatorでテスト自動化を始める前に知っておくと良いこと
Search
TOYAMA Sumio
December 21, 2014
Programming
0
1k
uiautomatorでテスト自動化を始める前に知っておくと良いこと
ABC 2014 WinterのLTセッションで発表した資料です。
TOYAMA Sumio
December 21, 2014
Tweet
Share
More Decks by TOYAMA Sumio
See All by TOYAMA Sumio
Understand the mechanism! Let's do screenshots tests of Compose Previews with various variations / 仕組みから理解する!Composeプレビューを様々なバリエーションでスクリーンショットテストしよう
sumio
6
4.5k
Roborazziでスクリーンショットを撮るときに役立つTips集 / A collection of useful tips for taking screenshots in Roborazzi
sumio
2
5.9k
DroidKaigi 2022: Gradle Managed Virtual Devicesで変化するエミュレータ活用術
sumio
2
9.1k
DeNA TechCon 2021 - スマホ向けゲームの辛い部分をコード自動生成技術で克服する / Overcoming the Painful Part of Smartphone Games Development with Automatic Code Generation
sumio
0
580
Robolectricの限界を理解してUIテストを高速に実行しよう / Let's run UI Test faster with understanding limit of Robolectric
sumio
3
9.5k
EspressoではじめるAndroid UIテスト / Android UI Testing Starting with Espresso
sumio
2
2.6k
Espressoの知識ゼロでも書ける!Android UIテストはじめの一歩 / The First Step of Android UI Testing
sumio
1
9k
EspressoのテストをAndroidの最新トレンドに対応させよう / Make Espresso testing follow the cutting edge in Android development
sumio
3
18k
KotlinでEspressoテストがもっと書きやすくなるKakaoを試してみた / Trying Kakao which makes Espresso test easier to write
sumio
2
1.1k
Other Decks in Programming
See All in Programming
関数型まつりレポート for JuliaTokai #22
antimon2
0
160
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
240
WindowInsetsだってテストしたい
ryunen344
1
200
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
330
ReadMoreTextView
fornewid
1
480
ニーリーにおけるプロダクトエンジニア
nealle
0
580
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
230
エンジニア向け採用ピッチ資料
inusan
0
160
datadog dash 2025 LLM observability for reliability and stability
ivry_presentationmaterials
0
120
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
4
990
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
110
Result型で“失敗”を型にするPHPコードの書き方
kajitack
4
500
Featured
See All Featured
Embracing the Ebb and Flow
colly
86
4.7k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Docker and Python
trallard
44
3.4k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
VelocityConf: Rendering Performance Case Studies
addyosmani
330
24k
Fireside Chat
paigeccino
37
3.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
Adopting Sorbet at Scale
ufuk
77
9.4k
Transcript
uiautomatorͰ ςετࣗಈԽΛ࢝ΊΔલʹ ͓ͬͯ͘ͱྑ͍͜ͱ 2014.12.21 @sumio_tym (TOYAMA Sumio)
Android Bazaar and Conference 2014 Winter
ࣗݾհ • ࢯ໊: ֎ࢁ७ੜ(TOYAMA Sumio) @sumio_tym (twitter), @sumio (github)
• ॴଐ: NTTιϑτΣΞגࣜձࣾ • ۀ༰: – ࣾAndroidؔ࿈ϓϩδΣΫτٕज़ࢧԉ • ϓϥΠϕʔτ: – STAR(ςετࣗಈԽݚڀձ) – uiautomatorΥονϟʔ(?) – uiautomatorͷهࣄॻ͖·ͨ͠ • http://www.atmarkit.co.jp/ait/articles/1410/07/news029.html • http://www.atmarkit.co.jp/ait/articles/1411/05/news038.html 2
• Android SDKඪ४ͷUIςετࣗಈԽπʔϧ http://developer.android.com/tools/testing/testing_ui.html • apk͕खݩʹແͯ͘ૢ࡞Ͱ͖Δ – ΞϓϦʹ·͕ͨͬͨૢ࡞OK!
– ϓϦΠϯΞϓϦOK! • Android 4.1Ҏ্ରԠ • WebViewͷૢ࡞ෆՄ 3 uiautomatorͬͯ? AndroidόʔδϣϯผγΣΞ(2014/12/1·Ͱͷ7ؒͷ౷ܭ) https://developer.android.com/about/dashboards/index.htmlΑΓҾ༻ 82.6% ͬͯΈͨ͘ͳΓ·ͤΜ͔?
͓͢͠Δ͜ͱ uiautomatorΛ͍࢝ΊΔલʹ ͓ͬͯ͘ͱศརͳ ϙΠϯτΛհ͠·͢! 4
ΞδΣϯμ • جຊతͳ͍͔ͨ • ςετ։࢝࣌ʹΞϓϦΛىಈ͢͠ • ຊޠςΩετͷೖྗ
5
• جຊతͳ͍͔ͨ • ςετ։࢝࣌ʹΞϓϦΛىಈ͢͠ • ຊޠςΩετͷೖྗ 6
جຊతͳ͍͔ͨ(1/2) • ʮOKϘλϯʯΛԡ͢ྫ 7 UiSelector criteria =
new UiSelector() .className(Button.class) .text("OK"); UiObject okButton = new UiObject(criteria); okButton.click(); ݕࡧ݅Λߏங ݅ʹ߹͏UI෦ Λ୳ͯ͠ΫϦοΫ!
جຊతͳ͍͔ͨ(2/2) 8 • ݕࡧ݅uiautomatorviewerͰ֬ೝ DDMSʼDevicesʼ
• جຊతͳ͍͔ͨ • ςετ։࢝࣌ʹΞϓϦΛىಈ͢͠ • ຊޠςΩετͷೖྗ 9
ςετ։࢝࣌ʹ ΞϓϦΛىಈ͢͠(1/2) • ΞϓϦΛىಈ͢͠ૢ࡞εΫϦϓτΛॻ ͍ͯྑ͍͕ɾɾ – ͍!
– ෳࡶ! 10 ϗʔϜ ϥϯνϟ ઃఆ ΞϓϦ ڧ੍ऴྃ
ςετ։࢝࣌ʹ ΞϓϦΛىಈ͢͠(2/2) • amίϚϯυΛςετεΫϦϓτ෦͔Β ࣮ߦ͢Δͷ͕؆୯! 11
Process p = new ProcessBuilder("am", "start", "-S", "-W", "-a", Intent.ACTION_MAIN, "-n", "<ύοέʔδ໊>/<Activity>") .start(); p.waitFor();
• جຊతͳ͍͔ͨ • ςετ։࢝࣌ʹΞϓϦΛىಈ͢͠ • ຊޠςΩετͷೖྗ 12
• จࣈྻೖྗʹ͏UiObject.setText(String) – Virtual Keyboard Device(=QWERTYΩʔϘʔυ)ͷ ΩʔΠϕϯτΛٖࣅతʹൃੜͤ͞Δ͜ͱͰೖྗΛ࣮ݱ
ຊޠςΩετͷೖྗ(1/2) • (΄΅)ASCIIҎ֎ΛؚΉจࣈྻೖྗແࢹ͞ΕΔ! • ಈ࡞தͷIMEʹӨڹ͞ΕΔ! ຊޠ IME Android ΩʔϘʔυ setText("aiueo"); http://source.android.com/devices/tech/input/key-‐character-‐map-‐files.html 13
ຊޠςΩετͷೖྗ(2/2) Uiautomator Unicode Input Helper (IME) [&MFMwkzBrMGEwbw-‐!] Λ[͜Μʹͪ!]ʹม
14 • ASCIIจࣈྻ͔ΒUnicodeʹม͢ΔIMEΛ͏ (࡞Γ·ͨ͠) Uiautomator Unicode Input Helper https://github.com/sumio/uiautomator-‐unicode-‐input-‐helper setText( Utf7ImeHelper.e("͜Μʹͪ!") ); "&MFMwkzBrMGEwbw-‐!"͕ฦΔ
ΑΓৄ͘͠ • ҎԼͷهࣄ(ˏITʹͯެ։)Λ͝ࢀর͍ͩ͘͞ – ʮAndroid SDKඪ४ͷԿͰςετπʔϧuiautomatorͷ جຊతͳ͍ํʯ http://www.atmarkit.co.jp/ait/articles/1410/07/news029.html
– ʮAndroidςετͰศརͳuiautomatorviewerɺ UiScrollableͷ͍ํɺςΩετೖྗAPI੍ݶࣄ߲ͷ ճආํ๏ʯ http://www.atmarkit.co.jp/ait/articles/1411/05/news038.html 15 ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ ˞STAR(ςετࣗಈԽݚڀձ)ͷ׆ಈͷҰͱͯࣥ͠ච͠·ͨ͠