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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With