Issue
I am trying out the new Android testing library Espresso. When I try:
onView(withId(R.id.gettingStarted))
The test runs fine. But when I try:
onView(withId(R.id.gettingStarted)).check(matches(isDisplayed()));
I get a .NoMatchingViewException: No views in hierarchy found matching: with id: is <2131296645>
Has anyone seen anything like this before? My initial reflex is that this is just a bug because Espresso is only on version 1.0. I am using Android Studio and followed the set up directions exactly.
Solution
This is expected behavior.
onView(withId(R.id.gettingStarted)) by itself doesn't do anything. When you invoke the perform method, Espresso runs the matcher provided inside the onView method against the current view hierarchy - if no matching view is found, the exception is thrown.
See the start guide for more details: https://developer.android.com/training/testing/espresso/index.html
Answered By - ValeraZakharov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.