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
980
uiautomatorでテスト自動化を始める前に知っておくと良いこと
ABC 2014 WinterのLTセッションで発表した資料です。
TOYAMA Sumio
December 21, 2014
Tweet
Share
More Decks by TOYAMA Sumio
See All by TOYAMA Sumio
Roborazziでスクリーンショットを撮るときに役立つTips集 / A collection of useful tips for taking screenshots in Roborazzi
sumio
2
1.1k
DroidKaigi 2022: Gradle Managed Virtual Devicesで変化するエミュレータ活用術
sumio
2
7.9k
DeNA TechCon 2021 - スマホ向けゲームの辛い部分をコード自動生成技術で克服する / Overcoming the Painful Part of Smartphone Games Development with Automatic Code Generation
sumio
0
480
Robolectricの限界を理解してUIテストを高速に実行しよう / Let's run UI Test faster with understanding limit of Robolectric
sumio
3
8k
EspressoではじめるAndroid UIテスト / Android UI Testing Starting with Espresso
sumio
2
2k
Espressoの知識ゼロでも書ける!Android UIテストはじめの一歩 / The First Step of Android UI Testing
sumio
1
6.6k
EspressoのテストをAndroidの最新トレンドに対応させよう / Make Espresso testing follow the cutting edge in Android development
sumio
3
17k
KotlinでEspressoテストがもっと書きやすくなるKakaoを試してみた / Trying Kakao which makes Espresso test easier to write
sumio
2
920
Espressoテストコードの同期処理を究める / Synchronization capabilities of Espresso
sumio
6
6.3k
Other Decks in Programming
See All in Programming
Material 3で Material 2ぽい見た目にする
numeroanddev
2
250
オブジェクト指向は必要なのか / Is object-oriented needed?
kishida
27
18k
MySQL のインデックスの種類をおさらいしよう! / overviewing indexes in MySQL
okashoi
0
170
チームでモデリングを育てるうえで 考えたこと・気づいたこと / Cultivating Modeling in Teams: Thoughts and Insights
mackey0225
5
1.7k
PHP で読む楽しいコアダンプ
sji
0
240
実践!RDRAを活用した既存システムの仕様変更 / Specification Changes in Existing Systems Utilizing RDRA
imamotohikaru
0
1.8k
決断するための勇気、そのためのBacklog / Courage to make decisions, Backlog for that.
seike460
PRO
4
1.9k
DDD, necessary but insufficient: physical design principles for microservices
cer
PRO
0
2.1k
自動テスト実行結果の目的を整理する / Organizing objectives of automated test results
twada
PRO
10
2.1k
Laravel OpenAPIによる"辛くない"スキーマ駆動開発
kentaroutakeda
2
2.1k
オブジェクトしこう
okuramasafumi
2
130
Learning PHP and Static Analysis with PHP Parser
inouehi
1
250
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
153
14k
Designing on Purpose - Digital PM Summit 2013
jponch
109
6.4k
Infographics Made Easy
chrislema
237
18k
Designing Experiences People Love
moore
135
23k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
6
950
ReactJS: Keep Simple. Everything can be a component!
pedronauck
657
120k
Web Components: a chance to create the future
zenorocha
304
41k
What's new in Ruby 2.0
geeforr
335
31k
Faster Mobile Websites
deanohume
296
30k
Stop Working from a Prison Cell
hatefulcrawdad
265
19k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
18
1.7k
Bash Introduction
62gerente
604
210k
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(ςετࣗಈԽݚڀձ)ͷ׆ಈͷҰͱͯࣥ͠ච͠·ͨ͠