Espresso is a native testing framework for running user interface tests on Android devices. Sauce Labs offers the option to run Espresso tests against emulators in our testing cloud with Sauce Runner for Virtual Devices.
Requirements
Supported Espresso Package Versions
Package | Minimum Version |
---|---|
com.android.support.test.espresso:espresso-core | 3.0.2 |
com.android.support.test.espresso:espresso-web | 3.0.2 |
com.android.support.test:runner | 1.0.2 |
com.android.support.test:rules | 1.0.2 |
junit:junit | 4.12 |
Max Test Execution Time
Recommended maximum execution time for Espresso jobs is 1 hour, however the emulators are capable of running Espresso jobs for 3 hours, and are shutdown after 3 hours.
Configuring Sauce Runner for Virtual Devices for Espresso Testing
The Command Reference for Sauce Runner for Virtual Devices contains a list of the options you can use to configure Sauce Runner to run tests with Espresso.
Emulator Settings for Espresso Tests
Following Google's recommendation to avoid flakey tests, we disable system animations on emulators during Espresso tests. Specifically the following three system animations are disabled:
- Window animation scale
- Transition animation scale
- Animator duration scale
Troubleshooting
When testing on Sauce emulators, one error to look out for is Espresso test suites running as expected on one Android version, but failing on another version (e.g., "Internal Server Error").
Potential Cause: Application under test requires a minimum Android version or above.
Recommendation: Check the minSdkVersion
in build.gradle
for your application project.