View all web browser and mobile devices available in our cloud-based test lab.
INTEGRATION FOR Espresso
Espresso is an Android-specific UI test automation framework. It's a dev-friendly solution to create unit and functional tests directly from the Android Studio IDE.
One of the benefits of Espresso testing over Appium is that this framework is fully developed, led, and maintained by Google. It is always up to date with recent features of the Android operating system.
This framework is embedded into the Android IDE, which is the de-facto development environment for Android native and hybrid apps. Because of this, it is easy to get started with. In addition, executing Espresso Android automation is fast due its unique architecture.
A developer who creates a mobile Android app can easily generate an Android Instrumented Test that co-exists within the same native application project (Android Instrumented Tests) and that is converted into an APK when the app is built. Both the app package APK and the test suite APK are launched when the test is run. This allows the test APK to execute on the app APK, contributing to a fully synchronized run.
As mentioned above, the Espresso APIs are all about simplicity and synchronization between test steps, making the execution reliable and fast on both virtual emulators and real devices in the Perfecto cloud.
As identified in the code snippet as well as the Espresso cheat sheet, to create Espresso UI tests, developers can use commands like onView or onData to perform actions and validations on the application objects. The object locators for Android and Espresso are accessed through the R.id.[xx] syntax that leverages R.Java automatically generated object files for the application under test.
The Android platform continues to be challenging to test and maintain due to the plethora of devices configurations. Leveraging the Espresso testing framework and Perfecto can benefit developers and test engineers as they expand their white box test automation through the following benefits:
Connecting your existing Espresso test script written in Java with the Perfecto cloud is quite simple. Perfecto has created a Gradle plugin that can be added to the Android project and help configure the cloud URL and the security token. These are required to connect the test to the cloud. In addition, through the configuration file (JSON), clients easily specify the devices under test and the Perfecto dependency.
Once the settings have been identified, the APK test file and the application APK files will be installed and executed on the Perfecto cloud devices.
Because the entire execution of Espresso test automation runs in the Perfecto cloud, it is guaranteed that the execution will be 100% stable on clean and secured Android devices. Executing the tests either from Android Studio or through Jenkins CI is fully supported and stable.
In addition to the execution stability, Perfecto’s cloud hosts over 10,000 different smartphones and tablets, allowing teams to extend their test coverage and scalability. Running Espresso tests across multiple real and virtual devices is fully supported and allows teams to identify Android device-specific issues across multiple configurations.
Like with any test execution in the Perfecto cloud, clients receive a detailed test execution report that includes screenshots, videos, logs, and failure root cause analysis classification. This capability helps eliminate noise. It allows teams to focus only on the real defects in the Android app under test. With the fast execution that Espresso facilitates and the fast feedback that Perfecto Smart Reporting provides, teams can deliver more quality apps faster.
Get started testing with the Espresso framework and Perfecto.
You can view a sample project of Espresso testing here. Access Perfecto’s documentation on Espresso here.