

You can see all the supported RecyclerViewActions (including how to interact with views inside of the RecyclerView item) here. Now we can use RecyclerViewActions to interact with our RecyclerView: // Click on the RecyclerView item at position 2 onView ( withId ( R. Under Settings => Developer options disable the following 3 settings and restart the device:įinally, we need to pull in the Espresso dependencies and set the test runner in our app adle: Since Espresso is a UI testing framework, system animations can introduce flakiness in our tests. It's recommended to turn off system animations on the device or emulator we will be using.

You'll also need to make sure you have the Android Support Repository version 15+ installed.

This is the default location for instrumentation tests. Make sure you have an app/src/androidTest/java folder. The default setting (the Android perspective) hides certain folders: This will show us a full view of everything contained in the project. There are several steps needed to setup Espresso with Android Studio:įirst, let's change to the Project perspective in the Project Window. In many circles Espresso is considered to be a full replacement for Robotium (see this stack overflow post that compares Robotium to Espresso). if a particular view is off screen, the test won't be able to interact with it).Įspresso's simple and extensible API, automatic synchronization of test actions with the UI of the app under test, and rich failure information make it a great choice for UI testing. Espresso tests run on actual device or emulator (they are instrumentation based tests) and behave as if an actual user is using the app (i.e. So I added below kotlin specific proguard rules in lib-wrapper's proguard-rules.Espresso is a UI test framework (part of the Android Testing Support Library) that allows you to create automated UI tests for your Android app.

lib-wrapper (Android-library module which contains Java classes).app (main/application module which contains both Java and Kotlin classes).
