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

Express Automation Using Espresso

Bharathan
February 16, 2017

Express Automation Using Espresso

Author: Arvind Srinivasan V
This ppt was given as talk in Thoughtworks VodQA Session - Feb 16

Bharathan

February 16, 2017
Tweet

More Decks by Bharathan

Other Decks in Programming

Transcript

  1. WHAT • A UI test framework (part of the Android

    Testing Support Library) • To create automated UI tests for Android app • Gradle + Android Studio support • Simple and Extensible API remains open for customization
  2. HOW • Install android support repository • In build.gradle dependencies

    androidTestCompile 'com.android.support.test.espresso:espresso- core:2.2.2' androidTestCompile 'com.android.support.test:runner:0.5' • Under default config testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" • Create class with @RunWith(AndroidJUnit4.class) • Specify Activity to be tested with @Rule and Create test functions with @Test
  3. Main components of Espresso : • Espresso – Entry point

    to interact with views and APIs not tied to view • ViewMatchers – To identify view within view hierarchy • ViewActions – Do action on view • ViewAssertions – Verify or Assert on view
  4. withId(R.id. error_msg ) withContentDescription ("More options" ) allOf (withId (R.id.

    error_msg_text ),withEffective Visibility (ViewMatchers.Visibility. VISIBLE ) allOf( withId (R.id. count ), hasSibling (withText (R.string. summary_header ) ViewMatchers
  5. • Webview • StubTesting using Intent and ServiceTestRule • Extend

    to test performance, memory leakage • Pretty reports Others
  6. • API is small, predictable and easy to learn •

    Support from API level 8 (Froyo) • Light weight, Fast and Reliable test • Rich failure information and customizable failure handling • Automatic synchronization of test actions loopmainthreaduntilidle • Can use UI automator methods • Runs on actual device or emulator, mimics user WHY
  7. • Application push notifications • Sync Test • Navigating from

    another app to your app • Extending test to other OS WHAT NOT
  8. • http://developer.android.com/ • https://github.com/codepath/android_guides/w i/UI-Testing-with-Espresso • https://google.github.io/android-testing-suppor -library/docs/espresso/cheatsheet/index.html Reference •

    http://developer.android.com/ • https://github.com/codepath/android_guides/w i/UI-Testing-with-Espresso • https://google.github.io/android-testing-suppor -library/docs/espresso/cheatsheet/index.html