Create Espresso Test Class

suggest change

Put this class in src/androidTest/java. @RunWith(AndroidJUnit4.class) is what marks it as an instrumentation test.

@RunWith(AndroidJUnit4.class)
public class UITest {

  @Test public void Simple_Test() {
    onView(withId(R.id.my_view))         // withId(R.id.my_view) is a ViewMatcher
        .perform(click())                // click() is a ViewAction
        .check(matches(isDisplayed()));  // matches(isDisplayed()) is a ViewAssertion
  }

}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents