I'm new for android testing. How to write test case for RecyclerView using Espresso Framework. Where my RecyclerView has a click listener and when click a item it passes intent to another activity. Please help me to write test case for this.
To click an item in RecyclerView:
See more on Espresso RecyclerView testing
onView(withId(R.id.scroll_view)).perform(RecyclerViewActions.actionOnItemAtPosition(3, click()));
To check if Intent is sent:
// to the "phone" activity has been sent.
intended(toPackage("com.android.phone"));
see more on Espresso Intent testing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.