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

Espresso Test Recorder

Espresso Test Recorder

magiepooh

June 17, 2016
Tweet

More Decks by magiepooh

Other Decks in Technology

Transcript

  1. Espresso Test Recorder • GoogleIO 2016 • Record Espresso UI

    tests simply by using your app as a normal user
  2. ViewInteraction appCompatButton = onView( allOf(withId(R.id.button_recycler), withText("RecyclerView"), withParent(allOf(withId(R.id.activity_main), withParent(withId(android.R.id.content)))), isDisplayed())); appCompatButton.perform(click());

    ViewInteraction recyclerView = onView(allOf(withId(R.id.recycler_view), isDisplayed())); recyclerView.check(matches(isDisplayed())); // >>> Developers need write this line to scroll RecyclerView onView(withId(R.id.recycler_view)).perform(RecyclerViewActions.scrollToPosition(19)); // <<< ViewInteraction appCompatButton2 = onView(allOf(withId(R.id.text_recycler), withText("position: 19"), isDisplayed())); appCompatButton2.perform(click());
  3. ViewInteraction appCompatButton = onView( allOf(withId(R.id.button_recycler), withText("RecyclerView"), withParent(allOf(withId(R.id.activity_main), withParent(withId(android.R.id.content)))), isDisplayed())); appCompatButton.perform(click());

    ViewInteraction recyclerView = onView(allOf(withId(R.id.recycler_view), isDisplayed())); recyclerView.check(matches(isDisplayed())); // >>> Developers need write this line to scroll RecyclerView onView(withId(R.id.recycler_view)).perform(RecyclerViewActions.scrollToPosition(19)); // <<< ViewInteraction appCompatButton2 = onView(allOf(withId(R.id.text_recycler), withText("position: 19"), isDisplayed())); appCompatButton2.perform(click());