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
php-conference-japan-2024
tasuku43
0
430
令和7年版 あなたが使ってよいフロントエンド機能とは
mugi_uno
10
5.1k
GitHub CopilotでTypeScriptの コード生成するワザップ
starfish719
26
6k
AWS re:Invent 2024個人的まとめ
satoshi256kbyte
0
100
ErdMap: Thinking about a map for Rails applications
makicamel
1
600
Оптимизируем производительность блока Казначейство
lamodatech
0
950
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
190
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
140
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
560
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.3k
functionalなアプローチで動的要素を排除する
ryopeko
1
190
Featured
See All Featured
Site-Speed That Sticks
csswizardry
2
270
Music & Morning Musume
bryan
46
6.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
5
210
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
How to Ace a Technical Interview
jacobian
276
23k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
4 Signs Your Business is Dying
shpigford
182
22k
Designing for Performance
lara
604
68k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Git: the NoSQL Database
bkeepers
PRO
427
64k
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*ʹؔͦ͠͏ͳओཁಋઢʹߜͬͯಋೖ͢Δͷ͕͓͢͢Ί