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

kotlin season 1 - Part 18 UI Test Code 작성하기

TaeHwan
November 21, 2016

kotlin season 1 - Part 18 UI Test Code 작성하기

2016년 유데미 Kotlin 강의를 공개합니다.

PPT :
동영상 : https://www.youtube.com/watch?v=KhTKkB2AgEc

2회 분은 유데미에서 확인 가능합니다.
http://bit.ly/2UpaJUR

TaeHwan

November 21, 2016
Tweet

More Decks by TaeHwan

Other Decks in Education

Transcript

  1. Part 18 Kotlin UI Test Code ੘ࢿೞӝ Taehwan ରࣁ؀ উ٘۽੉٘

    ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 1
  2. ࢠ೒ ௏٘ח!!! — Sample Code GitHub  : 12-UI-Test —

    https://github.com/taehwandev/Kotlin-Udemy- Sample/tree/12-UI-Test ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 2
  3. Test ௏٘ ੘ࢿ — Build High-Quality Apps ରࣁ؀ উ٘۽੉٘ ѐߊ

    ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 3
  4. UI Test ௏٘ ੘ࢿ — Android Testing Support Library —

    Espresso — AndroidJUnitRunner — JUnit4 Rules — UI Automator ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 4
  5. Espresso — Espresso Android UI    . —

    UI — Intents — WebView — ETC... ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 5
  6. Espresso @Test public void greeterSaysHello() { onView(withId(R.id.name_field)) .perform(typeText("Steve")); onView(withId(R.id.greet_button)) .perform(click());

    onView(withText("Hello Steve!")) .check(matches(isDisplayed())); } ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 6
  7. Espresso ੸ਊೞӝ android { defaultConfig { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } }

    dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) androidTestCompile 'com.android.support.test:runner:0.5' testCompile 'junit:junit:4.12' } ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 7
  8. ActivityTestRuleਸ ׮਺җ э੉ ࢤࢿ оמ @RunWith(AndroidJUnit4.class) @LargeTest public class HelloWorldEspressoTest

    { @Rule public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule(MainActivity.class); @Test public void listGoesOverTheFold() { onView(withText("Hello world!")).check(matches(isDisplayed())); } } ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 8
  9. JUnit4 — Test Apis — @Before : @Test ' 

     "+* (   * . @Test   ) ,# . — @After : @After  %& !  ,# .  resource release  — @Test : @Before    $ %& " ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 9
  10. ଵҊ ੗ܐ — Android Testing Support Library — Android user

    interface testing with Espresso - Tutorial — Android Testing Codelab — androidTest-JUnit4, Espresso   — Kotlin testing  — UI Testing with Espresso ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 11