mercredi 28 juin 2017

Wirte android espresso test

I need to write a UI test to validate that clicking the floating action button results in displaying the SecondActivity.

public class MainActivityTest {

  @Rule
  public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(
        MainActivity.class);

  @Before
  public void setUp() throws Exception {

  }

  @Test
  public void onClick() throws Exception {
      onView(withId(R.id.button)).perform(click());
  }
}

Is it enough?

And how can I validate that the Activity properly displays the text contents of an incoming object: name, age, phone number? I have just started using espresso(

Aucun commentaire:

Enregistrer un commentaire