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

Android Testing Bootcamp #5 Hands-On Vol.2

Android Testing Bootcamp #5 Hands-On Vol.2

Android Testing Bootcamp #5
Hands-On Vol.2

3cca191bf3064fd059ea2c3d6022afbd?s=128

Fumihiko Shiroyama

October 28, 2016
Tweet

More Decks by Fumihiko Shiroyama

Other Decks in Technology

Transcript

  1. "OESPJE5FTUJOH#PPUDBNQ )BOET0O7PM "OESPJE@5FTUJOH@#$

  2. w "OESPJE5FTUJOH#PPUDBNQ(SPVQ w IUUQBOESPJEUFTUJOH CPPUDBNQDPOOQBTTDPN w "OESPJE5FTUJOH#PPUDBNQ w IUUQBOESPJEUFTUJOH CPPUDBNQDPOOQBTTDPNFWFOU

  3. ࠓճར༻͢Δ؀ڥ

  4. w "OESPJE4UVEJP w IUUQTHJUIVCDPNTSZN5FTU)BOET0O w HJUDMPOFHJU!HJUIVCDPNTSZN 5FTU)BOET0OHJU w HJUDPNBTUFSྫ୊ϒϥϯν w

    HJUDPBOTXFSղ౴ྫϒϥϯν
  5. ΞδΣϯμ

  6. w લճͷ͓͞Β͍ w IUUQTTQFBLFSEFDLDPNTSZNBOESPJE UFTUJOHCPPUDBNQOVNCFSIBOETPO w &TQSFTTP w 3PCPMFDUSJD w

    IUUQTTQFBLFSEFDLDPNTSZN SPCPMFDUSJDEPUGPSCFHJOOFST
  7. લճͷ͓͞Β͍

  8. લճͷ͓͞Β͍ ࢿྉࢀর

  9. &TQSFTTP

  10. w (PPHMFެࣜ6*ςετϑϨʔϜϫʔΫ w IUUQTEFWFMPQFSBOESPJEDPNUSBJOJOH UFTUJOHVJUFTUJOHFTQSFTTPUFTUJOHIUNM

  11. CVJMEHSBEMF dependencies { // Other dependencies ... androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' }

  12. CVJMEHSBEMF dependencies { // Other dependencies ... androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' }

    ࠷ۙͷ؀ڥͰ͸σϑΥϧτͰ༗ޮʂ
  13. BOESPJE5FTU

  14. BOESPJE5FTU ͜͜ʹςετΛॻ͍͍ͯ͘

  15. ࡞๏

  16. @RunWith(AndroidJUnit4.class)
 public class MainActivityTest {
 
 @Rule
 public ActivityTestRule<MainActivity> mActivityTestRule

    = new ActivityTestRule<>(MainActivity.class);
 
 @Test
 public void TextViewʹදࣔ͞Ε͍ͯΔจࣈྻΛݕূ͢ΔςετίʔυΛॻ͜͏() {
 onView(withId(R.id.text)).check(ViewAssertions.matches(withText("Hello World!")));
 }
 
 }

  17. @RunWith(AndroidJUnit4.class)
 public class MainActivityTest {
 
 @Rule
 public ActivityTestRule<MainActivity> mActivityTestRule

    = new ActivityTestRule<>(MainActivity.class);
 
 @Test
 public void TextViewʹදࣔ͞Ε͍ͯΔจࣈྻΛݕূ͢ΔςετίʔυΛॻ͜͏() {
 onView(withId(R.id.text)).check(ViewAssertions.matches(withText("Hello World!")));
 }
 
 }

  18. @RunWith(AndroidJUnit4.class)
 public class MainActivityTest {
 
 @Rule
 public ActivityTestRule<MainActivity> mActivityTestRule

    = new ActivityTestRule<>(MainActivity.class);
 
 @Test
 public void TextViewʹදࣔ͞Ε͍ͯΔจࣈྻΛݕূ͢ΔςετίʔυΛॻ͜͏() {
 onView(withId(R.id.text)).check(ViewAssertions.matches(withText("Hello World!")));
 }
 
 }
 ىಈ͢Δ"DUJWJUZ
  19. @RunWith(AndroidJUnit4.class)
 public class MainActivityTest {
 
 @Rule
 public ActivityTestRule<MainActivity> mActivityTestRule

    = new ActivityTestRule<>(MainActivity.class);
 
 @Test
 public void TextViewʹදࣔ͞Ε͍ͯΔจࣈྻΛݕূ͢ΔςετίʔυΛॻ͜͏() {
 onView(withId(R.id.text)).check(ViewAssertions.matches(withText("Hello World!")));
 }
 
 }
 ࣗಈىಈ
  20. @RunWith(AndroidJUnit4.class)
 public class MainActivityTest {
 
 @Rule
 public ActivityTestRule<MainActivity> mActivityTestRule

    = new ActivityTestRule<>(MainActivity.class, false, false);
 
 @Test
 public void ActivityͷىಈλΠϛϯάΛ੍ޚ͍ͨ͠৔߹() {
 mActivityTestRule.launchActivity(new Intent());
 }
 }
 ࣗಈىಈͤͨ͘͞ͳ͍৔߹
  21. @RunWith(AndroidJUnit4.class)
 public class MainActivityTest {
 
 @Rule
 public ActivityTestRule<MainActivity> mActivityTestRule

    = new ActivityTestRule<>(MainActivity.class, false, false);
 
 @Test
 public void ActivityͷىಈλΠϛϯάΛ੍ޚ͍ͨ͠৔߹() {
 mActivityTestRule.launchActivity(new Intent());
 }
 }

  22. @RunWith(AndroidJUnit4.class)
 public class MainActivityTest {
 
 @Rule
 public ActivityTestRule<MainActivity> mActivityTestRule

    = new ActivityTestRule<>(MainActivity.class, false, false);
 
 @Test
 public void ActivityͷىಈλΠϛϯάΛ੍ޚ͍ͨ͠৔߹() {
 mActivityTestRule.launchActivity(new Intent());
 }
 }

  23. جຊ

  24. w PO7JFX XJUI*E 3JEUFYU DIFDL NBUDIFT XJUI5 FYU )FMMP8PSME 

    w PO7JFX BMM0G XJUI*E 3JECVUUPO  XJUI5FYU $-*$, QFSGPSN DMJDL 
  25. &TQSFTTP w PO7JFX w PO%BUB w DMPTF4PGU,FZCPBSE w QSFTT#BDL

  26. 7JFX.BUDIFST w IBT$POUFOU%FTDSJQUJPO  w XJUI1BSFOU .BUDIFS  w XJUI$IJME

    .BUDIFS  w IBT&SSPS5FYU  w IBT'PDVT  w IBT4JCMJOH  w JT$IFDLFE  w JT$MJDLBCMF  w JT&OBCMFE  w XJUI5FYU 
  27. 7JFX*OUFSBDUJPO w DIFDL w QFSGPSN

  28. 7JFX"DUJPOT w DMJDL  w EPVCMF$MJDL  w MPOH$MJDL 

    w QSFTT#BDL  w QSFTT.FOV,FZ  w TXJQF%PXO TXJQF6Q  w TXJQF-FGU TXJQF3JHIU  w UZQF5FYU 
  29. ϋϯζΦϯ w IFMMPFTQSFTTPͷ.BJO"DUJWJUZ5FTUΛ࣮૷ͯͩ͘͠ ͍͞ʂ

  30. ϋϯζΦϯ w BQQ-PHJO"DUJWJUZ5FTUΛ࣮૷͍ͯͩ͘͠͞ʂ

  31. 3PCPMFDUSJD

  32. 3PCPMFDUSJD ࢿྉࢀর