ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 69 - Associate Android Developer discussion

Report
Export

The following code snippet shows an example of an Espresso test:

A.
@Rule public void greeterSaysHello() {onView(withId(R.id.name_field)).do(typeText("Steve")); onView(withId(R.id.greet_button)).do(click());onView(withText("Hello Steve!")).check(matches(isDisplayed())); }
Answers
A.
@Rule public void greeterSaysHello() {onView(withId(R.id.name_field)).do(typeText("Steve")); onView(withId(R.id.greet_button)).do(click());onView(withText("Hello Steve!")).check(matches(isDisplayed())); }
B.
@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())); }
Answers
B.
@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())); }
C.
@Test public void greeterSaysHello() {onView(withId(R.id.name_field)).do(typeText("Steve")); onView(withId(R.id.greet_button)).do(click());onView(withText("Hello Steve!")).compare(matches(isDisplayed())); }
Answers
C.
@Test public void greeterSaysHello() {onView(withId(R.id.name_field)).do(typeText("Steve")); onView(withId(R.id.greet_button)).do(click());onView(withText("Hello Steve!")).compare(matches(isDisplayed())); }
Suggested answer: B
asked 18/09/2024
Balazs Jarmy
48 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first