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.6k
Roborazziでスクリーンショットを撮るときに役立つTips集 / A collection of useful tips for taking screenshots in Roborazzi
sumio
2
6k
DroidKaigi 2022: Gradle Managed Virtual Devicesで変化するエミュレータ活用術
sumio
2
9.2k
DeNA TechCon 2021 - スマホ向けゲームの辛い部分をコード自動生成技術で克服する / Overcoming the Painful Part of Smartphone Games Development with Automatic Code Generation
sumio
0
590
Robolectricの限界を理解してUIテストを高速に実行しよう / Let's run UI Test faster with understanding limit of Robolectric
sumio
3
9.6k
EspressoではじめるAndroid UIテスト / Android UI Testing Starting with Espresso
sumio
2
2.7k
Espressoの知識ゼロでも書ける!Android UIテストはじめの一歩 / The First Step of Android UI Testing
sumio
1
9.1k
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
Android 16KBページサイズ対応をはじめからていねいに
mine2424
0
640
テスターからテストエンジニアへ ~新米テストエンジニアが歩んだ9ヶ月振り返り~
non0113
2
240
A full stack side project webapp all in Kotlin (KotlinConf 2025)
dankim
0
150
リバースエンジニアリング新時代へ! GhidraとClaude DesktopをMCPで繋ぐ/findy202507
tkmru
4
1.2k
Streamlitで実現できるようになったこと、実現してくれたこと
ayumu_yamaguchi
2
210
オンコール⼊⾨〜ページャーが鳴る前に、あなたが備えられること〜 / Before The Pager Rings
yktakaha4
2
1.1k
SwiftでMCPサーバーを作ろう!
giginet
PRO
2
190
AWS Summit Japan 2024と2025の比較/はじめてのKiro、今あなたは岐路に立つ
satoshi256kbyte
1
240
Claude Code で Astro blog を Pages から Workers へ移行してみた
codehex
0
140
Vibe Codingの幻想を超えて-生成AIを現場で使えるようにするまでの泥臭い話.ai
fumiyakume
18
9.1k
状態遷移図を書こう / Sequence Chart vs State Diagram
orgachem
PRO
2
250
Startups on Rails in Past, Present and Future–Irina Nazarova, RailsConf 2025
irinanazarova
0
290
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Six Lessons from altMBA
skipperchong
28
3.9k
How STYLIGHT went responsive
nonsquared
100
5.6k
Rails Girls Zürich Keynote
gr2m
95
14k
Designing for humans not robots
tammielis
253
25k
How to train your dragon (web standard)
notwaldorf
96
6.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
235
140k
Speed Design
sergeychernyshev
32
1k
A designer walks into a library…
pauljervisheath
207
24k
4 Signs Your Business is Dying
shpigford
184
22k
Code Reviewing Like a Champion
maltzj
524
40k
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(ςετࣗಈԽݚڀձ)ͷ׆ಈͷҰͱͯࣥ͠ච͠·ͨ͠