Posted by: Pdfprep
Post Date: May 26, 2021
The following code snippet shows an example of an Espresso test:
A . @Rule
public void greeterSaysHello() {
onView(withId(
B . id.name_field)).do(typeText("Steve"));
onView(withId(
C . id.greet_button)).do(click());
onView(withText("Hello Steve!")).check(matches(isDisplayed()));
}
D . @Test
public void greeterSaysHello() {
onView(withId(
E . id.name_field)).perform(typeText("Steve")); onView(withId(
F . id.greet_button)).perform(click()); onView(withText("Hello Steve!")).check(matches(isDisplayed())); }
G . @Test
public void greeterSaysHello() {
onView(withId(
H . id.name_field)).do(typeText("Steve"));
onView(withId(
. id.greet_button)).do(click());
onView(withText("Hello Steve!")).compare(matches(isDisplayed()));
}
Answer: B
Leave a Reply