Upgrade to Pro — share decks privately, control downloads, hide ads and more …

android-app-ui-testing

 android-app-ui-testing

DevOps勉強会#2 (https://zawatt.doorkeeper.jp/events/27232 ) で発表した資料です。

Avatar for muran001

muran001

July 20, 2015
Tweet

Other Decks in Programming

Transcript

  1. &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”))); } 〜略〜 } テスト対象   特定の要素に テスト内容   特定の文字列が表示されている
  2. ෳ਺ಉ࣌ςετ (*'Ξχϝʣ  BOESPJE   BOESPJE   BOESPJE

     ಛผͷઃఆෆཁɻςετલʹෳ਺ΤϛϡϨʔλىಈ͢Δ͚ͩ
  3. ΤϛϡϨʔλ࡞੒ $ echo n | android create avd --force –name

    my-android-21 --target android-21 ΤϛϡϨʔλΛϔουϨεىಈ $ emulator -avd circleci-android-21 -no-skin -no-audio -no-window & ҰԠͰ͖Δ͜ͱ͕Θ͔ͬͨ
  4. ΤϛϡϨʔλىಈ଴ͪ $ 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ʹͳΔ·Ͱ̎ඵ͓͖ʹ֬ೝ ˠىಈ͖͠Βͳ͍ͱςετΛ౤ೖͰ͖ͳ͍
  5. ΤϛϡϨʔλʔىಈΛௐ੔͢Δ $ echo n | android create avd --force –name

    my-android-21 --target android-21 -c 50M -s WXGA800 ͜ΕͰແࣄϩʔΧϧ؀ڥͰϔουϨεͳςετ͕௨Γ·ͨ͠ ը໘αΠζɺ4%Χʔυ༰ྔΛࢦఆ
  6. 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” 〜 略 〜 ˠϓϦΠϯετʔϧͯ͠Δͬͯॻ͍ͯ͋Δͷʹೖͬͯͳ͔ͬͨ ϓϦΠϯετʔϧ࣮͸͞Εͯͳ͔ͬͨ΋ͷΛΠϯετʔϧ
  7. ઃఆ͸ෳ਺෼૿΍͚ͩ͢ # 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 〜 略 〜 ˡࣗ࡞ͷΞϨ ˡࣗ࡞ͷΞϨ ˡࣗ࡞ͷΞϨ ˢ̎୆໨ىಈ ˢ̍୆໨ىಈ ˢ̎୆໨࡞੒ ˢ̍୆໨࡞੒
  8. ·ͱΊ •  ΞϓϦͷ6*ςετ͸ϋϚΓͲ͜Ζຬࡌ •  ΤϛϡϨʔλʔͷίϚϯυૢ࡞ͱ஥ྑ͘ͳΓ·͠ΐ͏ •  ͦ͜Λ৐Γӽ͑Δͱ޾͕ͤ଴͍ͬͯΔ •  ΞϓϦͷόʔδϣϯຖ֬ೝΛਓखͰ΍Βͳͯ͘ࡁΉ • 

    ࣮ػΛෳ਺ܨ͛Ε͹ػछґଘͷ֬ೝ΋Ͱ͖Δ •  6*ςετ͸30*Λߟ࣮͑ͭͭ૷͠Α͏ •  ,1*ʹؔ܎ͦ͠͏ͳओཁಋઢʹߜͬͯಋೖ͢Δͷ͕͓͢͢Ί