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
android-app-ui-testing
Search
muran001
July 20, 2015
Programming
4
1.1k
android-app-ui-testing
DevOps勉強会#2 (
https://zawatt.doorkeeper.jp/events/27232
) で発表した資料です。
muran001
July 20, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
rails_girls_is_my_gate_to_join_the_ruby_commuinty
maimux2x
0
200
Jakarta EE meets AI
ivargrimstad
0
390
Kotlin 2.0 and Beyond
antonarhipov
2
150
Some more adventure of Happy Eyeballs
coe401_
2
190
Google Sign-inの移行から始めるCredential Manager活用
clockvoid
0
310
Perl 5 OOP機構30年史 - Perl 5's OOP Mechanism over the past 30 years
moznion
0
260
Pythonで改めて考える「クラス(class)」の使いどころ
os1ma
1
450
Android開発以外のAndroid開発経験の活かしどころ
konifar
2
1k
エラーレスポンス設計から考える、0→1開発におけるGraphQLへの向き合い方
bicstone
5
1.5k
2024 컴포즈 정원사
jisungbin
0
150
Lessons by WebAssembly app in production on CDN Edge Computing Service
tetsuharuohzeki
0
210
Modular Monolith Go Server with GraphQL Federation + gRPC
110y
1
580
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
128
8.8k
Learning to Love Humans: Emotional Interface Design
aarron
270
40k
A Modern Web Designer's Workflow
chriscoyier
691
190k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
0
120
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
28
1.6k
A designer walks into a library…
pauljervisheath
201
24k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
278
13k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
45
4.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
36
2.1k
Fireside Chat
paigeccino
31
2.9k
Creatively Recalculating Your Daily Design Routine
revolveconf
215
12k
Unsuck your backbone
ammeep
667
57k
Transcript
"OESPJEΞϓϦͷ6*ςετΛ %FW0QTษڧձ!౦ژ .BTBUPTIJ.VSBLBNJ $JSDMF$*ͰͿΜճ͢
NVSBO .BTBUPTIJ.VSBLBNJ -JWFOTF *OD
2JJUBͬͯ·͢ʂ
ຊͷ͋Β͢͡ UIテスト ͜͜ΒΜ
ΞϓϦͷಈ࡞֬ೝؤுͬͯ·͔͢ʁ
ਓւઓज़Ͱͬͯ·͢ʂʢΩϦο εΫϦʔϯγϣοτࡱͬͯ&YDFMʹʜ
ਖ਼μα͍ɺͦͯ͠πϥ͍
ΠέͯΔΓํͳ͍ͷ͔ʁ
ࣗಈ 6*ςετͰ͠ΐʂʂ ʢ͑
"OESPJEͷ6*ςετ • 3PCPUJVN • &TQSFTTP • 6*"VUPNBUPS • "QQJVN •
ɾɾɾ ΤϛϡϨʔλΛͬͯࣗಈͰಈ࡞֬ೝ
&TQSFTTPͬͨྫ @RunWith(AndroidJUnit4.class) public class EspressoTest extends ActivityInstrumentationTestCase2<TopActivity> { 〜略〜 @Test
public void squareTest() { onView(withId(R.id.result_text)).check(match(withText(“2”))); onView(withId(R.id.square_button)).perform(click()); onView(withId(R.id.result_text)).check(match(withText(“4”))); } 〜略〜 } テスト対象 特定の要素に テスト内容 特定の文字列が表示されている
&TQSFTTPͷ࣮ߦ $ ./gradlew connectedAndroidTest &TQSFTTPͷ݁Ռ֬ೝ $ open app/build/outputs/reports/androidTests/connected/index.html
ෳಉ࣌ςετ (*'Ξχϝʣ BOESPJE BOESPJE BOESPJE
ಛผͷઃఆෆཁɻςετલʹෳΤϛϡϨʔλىಈ͢Δ͚ͩ
Ϩϙʔτྫ
ϨϙʔτΠέͯͳ͍ɹʕ→ᴥ←ʔ
ΠέͯΔϨϙʔτπʔϧ4QPPO ҆৺ͷ4RVBSF
4QPPOͷ͍͍ͱ͜Ζ • σόΠεʢΤϛϡϨʔλʣຖʹϨϙʔτ͚ • ςετͰεΫϦʔϯγϣοτΛࡱΕΔ • εΫϦʔϯγϣοτΛϨϙʔτʹฒͯ͘ΕΔ • εΫϦʔϯγϣοτΛ(*'Ξχϝʹͯ͘͠ΕΔ •
ৄࡉϩάݟ͍͢ • ɾɾɾ
4QPPOͷϨϙʔτྫ̍
4QPPOͷϨϙʔτྫ̎
͜ΕͰΞϓϦ։ൃָ͕͘͠ͳͬͨʁ
͍͍͑ɺͦΕ͕ۤͷ࢝·ΓͰͨ͠
• ෳಉ࣮࣌ߦͯ͠.BDCPPL͕͓ͪΔ • ࣮ߦͷʹϨϙʔτ͕ΫϦΞ͞ΕΔ • εΫϦʔϯϩοΫঢ়ଶͩͱࣦഊ͢Δʢෳղআ໘ʣ • ϩʔΧϧͰ࣮ߦͯ͠ଞͷ։ൃऀͱ݁Ռڞ༗Ͱ͖ͳ͍ʢࣗݾຬʣ • ɾɾɾɾ
6*ςετʹཱ͔ͪͩΔน ࣗͷ1$ͰΖ͏ͱ͢Δͱ
ͦΕ $*ͰղܾͰ͖ͳ͍ͷʁ
+FOLJOT͏ʁ "OESPJE&NVMBUPS1MVHJO͕ෆ҆ఆ ͦͦ+FOLJOTΠέͯͳ͍
ΞϓϦ։ൃͱ͍͑$JSDMF$*Ͱ͠ΐʂ
ਏ͍֨ಆͷ࢝·Γ
֨ಆ̍ ϔουϨεͳΤϛϡϨʔλʔߏங ը໘ͳ͠ͷΤϛϡϨʔλͬͯ࡞ΕΔͷʁ
ΤϛϡϨʔλ࡞ $ echo n | android create avd --force –name
my-android-21 --target android-21 ΤϛϡϨʔλΛϔουϨεىಈ $ emulator -avd circleci-android-21 -no-skin -no-audio -no-window & ҰԠͰ͖Δ͜ͱ͕Θ͔ͬͨ
ΤϛϡϨʔλىಈͪ $ adb shell getprop init.svc.bootanim stopped ىಈྃ ʹϒʔτΞχϝʔγϣϯ͕ऴྃ ʹJOJUTWDCPPUBOJNϓϩύςΟ͕TUPQQFE
#!/bin/bash 〜略〜 STATUS=$(adb shell getprop init.svc.bootanim | tr –d [:space:]) while [ ”$STATUS" != “stopped" ]; do sleep 2 STATUS=$(adb shell getprop init.svc.bootanim | tr -d [:space:]) done BECXBJUGPSEFWJDF͑ͳ͍ͷͰఆظతʹঢ়ଶࢹ TUPQQFEʹͳΔ·Ͱ̎ඵ͓͖ʹ֬ೝ ˠىಈ͖͠Βͳ͍ͱςετΛೖͰ͖ͳ͍
εΫϦʔϯϩοΫղআ $ adb shell input keyevent 82 ͳΜ͔ͨ·ʹ͜Ε͕Ͱ͖ͳ͍߹͕͋Δ͚ͲṖ ΩʔΠϕϯτΛൃߦ͠ϩοΫΛղআ ˠىಈྃͯ͠ϩοΫ͞Εͨ··ͳΒςετೖͰ͖ͳ͍ʢϔουϨε͔ͩΒؾ͖ͮʹ͍͘55
࣮ͦͯ͠ߦͯ͠ΈΔͱɾɾɾ ςετམͪΔ ཧ༝ • ը໘αΠζখ͔͗ͨ͢͞Β • 4%ΧʔυྖҬͳ͔͔ͬͨΒ
ΤϛϡϨʔλʔىಈΛௐ͢Δ $ echo n | android create avd --force –name
my-android-21 --target android-21 -c 50M -s WXGA800 ͜ΕͰແࣄϩʔΧϧڥͰϔουϨεͳςετ͕௨Γ·ͨ͠ ը໘αΠζɺ4%Χʔυ༰ྔΛࢦఆ
֨ಆ̎ $JSDMF$*Ͱ࣮ߦ $JSDMF$*ͰϔουϨεͳςετͰ͖Μͷʁ
DJSDMFZNM࡞ʢͳ͍ͷՃʣ # circle.yml 〜 略 〜 dependencies: pre: - echo y
| android update sdk --no-ui --all --filter "extra-android-m2repository" - echo y | android update sdk --no-ui --all --filter "extra-android-support" - echo y | android update sdk --no-ui --all --filter "extra-google-m2repository” 〜 略 〜 ˠϓϦΠϯετʔϧͯ͠Δͬͯॻ͍ͯ͋Δͷʹೖͬͯͳ͔ͬͨ ϓϦΠϯετʔϧ࣮͞Εͯͳ͔ͬͨͷΛΠϯετʔϧ
ෳΤϛϡϨʔλىಈͪ $ circle-‐android wait-‐for-‐boot ࣮༻ҙ͞Ε͍ͯͨɻͰ̍ ෳ͋Δ߹ɺ શىಈ͔ྃͯ͠Βςετೖ͢Δඞཁ͋Γ
Ͳ͏͢Δʂʁʁ ˠىಈͪεΫϦϓτ࣮͋ͬͨʂʂͰ̍ͷΈରԠͩͬͨɾɾɾ
ෳΤϛϡϨʔλىಈͪ XBJUGPSCPPUΛෳʹରԠͤ͞Δํ๏͋Δʁ ͋ͬͨΒڭ͑ͯ͘Μͳ͍ʁ ͶʔΑLTHʂ ͨͩͷγΣϧεΫϦϓτ͔ͩΒࣗͰվ͠Ζ ࢲ தͷਓ தͷਓʹνϟοτͰ͍߹ΘͤͯΈͨɾɾɾɾ
ʀТʀʆ ŲƄƂŕ ࢲ
ෳΤϛϡϨʔλىಈͪ ํͳ͘࡞ͬͨɾɾɾৄࡉ8&#Ͱ # 複数台の起動と起動完了待ち $ start-emulators # 複数台のスクリーンロック解除
$ unlock-emulators # 複数台の停止 $ stop-emulators
4QPPO࣮ߦ # circle.yml test: override: 〜略〜 - ./gradlew spoon ͜ΕͰແࣄ$JSDMF$*ڥͰςετ͕௨Γ·ͨ͠
$JSDMF$*্ͰϨϙʔτӾཡ օͰڞ༗Ͱ͖ΔɹˍɹϨϙʔτ͕ͣͬͱΔ
֨ಆ $JSDMF$*Ͱෳ࣮ߦ $JSDMF$*ͷੑೳΓΔʁ
ઃఆෳ૿͚ͩ͢ # circle.yml 〜 略 〜 test: pre: - echo n
| android create avd --force --name circleci-android-21 --target android-21 -s WXGA800 - echo n | android create avd --force --name circleci-android-19 --target android-19 -s WXGA800 - emulator -avd circleci-android-21 -no-skin -no-audio -no-window: background: true parallel: true - emulator -avd circleci-android-19 -no-skin -no-audio -no-window: background: true parallel: true - ./start-emulators override: - ./unlock-emulators - ./gradlew spoon –PdisablePreDex post: - ./stop-emulators 〜 略 〜 ˡࣗ࡞ͷΞϨ ˡࣗ࡞ͷΞϨ ˡࣗ࡞ͷΞϨ ˢ̎ىಈ ˢ̍ىಈ ˢ̎࡞ ˢ̍࡞
ཧ༝ • ϝϞϦΓͳ͍ͱڧ੍తʹམͪΔ ࣮ͦͯ͠ߦͯ͠ΈΔͱɾɾɾ ςετམͪΔ
1SF%FYJOHΛແޮԽ 設定はWEBで http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server- performance ϝϞϦઃఆมߋ machine: environment: JAVA_OPTS: "-Xms256m -Xmx512m”
ىಈݮΒ͢ ˠ͕̎ݶքͳײ͡ʢίϯςφ૿͢ͱ͍͚Δ͔ʁʣ
͍ઓ͍ʹউར(๑•̀ŷ•́)و✧
·ͱΊ • ΞϓϦͷ6*ςετϋϚΓͲ͜Ζຬࡌ • ΤϛϡϨʔλʔͷίϚϯυૢ࡞ͱྑ͘ͳΓ·͠ΐ͏ • ͦ͜ΛΓӽ͑Δͱ͕͍ͤͬͯΔ • ΞϓϦͷόʔδϣϯຖ֬ೝΛਓखͰΒͳͯ͘ࡁΉ •
࣮ػΛෳܨ͛Εػछґଘͷ֬ೝͰ͖Δ • 6*ςετ30*Λߟ࣮͑ͭͭ͠Α͏ • ,1*ʹؔͦ͠͏ͳओཁಋઢʹߜͬͯಋೖ͢Δͷ͕͓͢͢Ί