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 device configurations. While Espresso is an excellent framework for testing Android applications, you can expand your testing even further when you combine the Espresso testing framework with a commercial platform.
Leveraging the Espresso testing framework and Perfecto is a great way to get the benefits of an Android-specific framework with a broader platform. Integrating Espresso with Perfecto can help developers and test engineers take their white box test automation to the next level 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, including both real and virtual devices. Not only does Perfecto's cloud-based testing lab allow teams to extend their test coverage and scalability, but the support for real and virtual devices enables teams to test faster and fix bugs at earlier stages of development.
Running Espresso tests across multiple real and virtual devices in the Perfecto cloud allows teams to identify Android device-specific issues across multiple configurations. Your organization can feel confident that they are doing all the testing necessary to release a high-quality Android application in a timely and cost-effective manner.
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.