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
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
200
AIエージェントによるテストフレームワーク Arbigent
takahirom
0
380
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
2
550
技術懸念に立ち向かい 法改正を穏便に乗り切った話
pop_cashew
0
1.4k
Blueskyのプラグインを作ってみた
hakkadaikon
1
550
DroidKnights 2025 - 다양한 스크롤 뷰에서의 영상 재생
gaeun5744
3
190
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
0
3k
GoのWebAssembly活用パターン紹介
syumai
3
10k
Bytecode Manipulation 으로 생산성 높이기
bigstark
1
340
Passkeys for Java Developers
ynojima
3
860
事業戦略を理解してソフトウェアを設計する
masuda220
PRO
22
6.1k
エラーって何種類あるの?
kajitack
5
150
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
14k
Building Applications with DynamoDB
mza
95
6.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Optimising Largest Contentful Paint
csswizardry
37
3.3k
Why Our Code Smells
bkeepers
PRO
337
57k
A designer walks into a library…
pauljervisheath
206
24k
RailsConf 2023
tenderlove
30
1.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
780
Visualization
eitanlees
146
16k
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(ςετࣗಈԽݚڀձ)ͷ׆ಈͷҰͱͯࣥ͠ච͠·ͨ͠