Reading-notes

Espresso

***********************

ex: @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())); }

********************

What is espresso ?

-The Espresso framework is part of the androidx library. This framework gives an Android developer the ability to automate UI tests.

1- Find a view - Tell the framework what view to find. We use the ViewMatcher class to find a view.

2- Perform an action - Tell the framework what to do on the view. We use the ViewAction class to perform an action on a view.

3- Assert the results - Check whether the result reflects the expected one. We use the ViewAssertion class for assertions.