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
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
たのしいparse.y
ydah
3
120
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
460
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
170
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
270
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
Featured
See All Featured
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Mobile First: as difficult as doing things right
swwweet
222
9k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
GitHub's CSS Performance
jonrohan
1030
460k
Speed Design
sergeychernyshev
25
670
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*ʹؔͦ͠͏ͳओཁಋઢʹߜͬͯಋೖ͢Δͷ͕͓͢͢Ί