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

Fumihiko Shiroyama

October 28, 2016
Tweet

More Decks by Fumihiko Shiroyama

Other Decks in Technology

Transcript

  1. @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!")));
 }
 
 }

  2. @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!")));
 }
 
 }

  3. @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
  4. @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!")));
 }
 
 }
 ࣗಈىಈ
  5. @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());
 }
 }
 ࣗಈىಈͤͨ͘͞ͳ͍৔߹
  6. @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());
 }
 }

  7. @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());
 }
 }

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

    w PO7JFX BMM0G XJUI*E 3JECVUUPO  XJUI5FYU $-*$, QFSGPSN DMJDL 
  9. 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 
  10. 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