Set up Espresso
BitBar Testing has had Espresso support since its first versions. This guide shows how to set up Android Studio and Espresso v2.0. The same or a similar setup should work for Eclipse and Android SDK as well.
In Android SDK, go to Tools > Android > SDK Manager.
Make sure that Android Support Repository is installed. It is located under Extras.
Open the app/build.gradle file in a text editor and add the following code to dependencies:
If the application under test uses functionality from
espresso-contrib, add the following code to dependencies as well:
Configure the instrumentation runner with the
testInstrumentationRunnerparameter. The build.gradle file should look like this:
For more information about Espresso Resource, see:
AndroidJUnitRunner is a new unbundled test runner for Android, which is part of the Android Support Test Library and can be downloaded via the Android Support Repository. The new runner contains all improvements of GoogleInstrumentationTestRunner and adds more features, such as:
Instrumentation Registry for accessing Instrumentation, Context, and Bundle Arguments
Test Filters @SdkSuppress and @RequiresDevice
Sharding of tests
RunListener support to hook into the test run lifecycle
Activity monitoring mechanism - ActivityLifecycleMonitorRegistry
For details, see the AndroidJUnitRunner user guide.