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
Quine, Polyglot, 良いコード
qnighy
4
640
CSC509 Lecture 09
javiergs
PRO
0
140
受け取る人から提供する人になるということ
little_rubyist
0
230
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
RubyLSPのマルチバイト文字対応
notfounds
0
120
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
870
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Jakarta EE meets AI
ivargrimstad
0
510
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
110
Contemporary Test Cases
maaretp
0
130
Featured
See All Featured
Building Adaptive Systems
keathley
38
2.3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Teambox: Starting and Learning
jrom
133
8.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Scaling GitHub
holman
458
140k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
How to train your dragon (web standard)
notwaldorf
88
5.7k
BBQ
matthewcrist
85
9.3k
How STYLIGHT went responsive
nonsquared
95
5.2k
Facilitating Awesome Meetings
lara
50
6.1k
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*ʹؔͦ͠͏ͳओཁಋઢʹߜͬͯಋೖ͢Δͷ͕͓͢͢Ί