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
990
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
2.9k
DroidKaigi 2022: Gradle Managed Virtual Devicesで変化するエミュレータ活用術
sumio
2
8.3k
DeNA TechCon 2021 - スマホ向けゲームの辛い部分をコード自動生成技術で克服する / Overcoming the Painful Part of Smartphone Games Development with Automatic Code Generation
sumio
0
510
Robolectricの限界を理解してUIテストを高速に実行しよう / Let's run UI Test faster with understanding limit of Robolectric
sumio
3
8.5k
EspressoではじめるAndroid UIテスト / Android UI Testing Starting with Espresso
sumio
2
2.2k
Espressoの知識ゼロでも書ける!Android UIテストはじめの一歩 / The First Step of Android UI Testing
sumio
1
7.5k
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
1k
Espressoテストコードの同期処理を究める / Synchronization capabilities of Espresso
sumio
6
6.5k
Other Decks in Programming
See All in Programming
【Go言語】golangci-lintの使い方
tomo1227
0
270
CSC307 Lecture 13
javiergs
PRO
0
150
Async Await: Mastering Python's Time-Bending Tricks - EuroPython2024
yanbo
1
290
Polarsの成長: v0.14からv1.0までの変遷と今後の展望
zerebom
1
350
Harnessing Large Language Models for Training-free Video Anomaly Detection
tereka114
1
1.3k
CSC307 Lecture 11
javiergs
PRO
0
240
Product Management LT会_クアンド新家
shinshin
0
210
3 Effective Rules for Success with Signals in Angular
manfredsteyer
PRO
0
120
Rubyのパフォーマンスプロファイリングの改善 / Enhancing performance profiling for Ruby
osyoyu
1
410
Webエディタライブラリ 「CodeMirror」から学ぶ Webアプリ開発のテクニック
ryosukeigarashi
0
250
AWS初心者ってどうやってAWSを学ぶ?〜アプリエンジニアがやってよかったアーキテクチャ学習方法〜
yamanashi_ren01
0
190
継続的な活動で築く地方エンジニアの道
myamashii
2
350
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
How to Ace a Technical Interview
jacobian
274
23k
How to Think Like a Performance Engineer
csswizardry
4
590
How to name files
jennybc
67
96k
Atom: Resistance is Futile
akmur
261
25k
Building Flexible Design Systems
yeseniaperezcruz
323
37k
Scaling GitHub
holman
458
140k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.9k
Stop Working from a Prison Cell
hatefulcrawdad
266
20k
Done Done
chrislema
179
15k
Mobile First: as difficult as doing things right
swwweet
219
8.8k
Docker and Python
trallard
37
2.9k
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(ςετࣗಈԽݚڀձ)ͷ׆ಈͷҰͱͯࣥ͠ච͠·ͨ͠