Close popover
Wojciech Grygierzec (grygw)
Sr. Software Engineer - Test Tools & Infrastructure
Pegasystems Inc.
grygw Member since 2013 1 post
Posted: November 30, 2018
Last activity: December 3, 2018

Mobile testing with Espresso framework


Espresso is a framework created by Google company for the purpose of testing of an Android UI. Its code utilizes the code from the application under test and it is proven to be the fastest and most reliable testing tool on the market. With Espresso Web it is possible to perform any action on any web element, not only native ones, so it can be used for testing hybrid applications. Works on real devices as well as emulators and it is possible to run tests at the same time on all connected devices.


  • IT IS REALLY FAST - and it is most important thing taking into account how many tests we may have. UI tests are slow and costly, it may happen you are not able to run all of them.
  • IT IS LESS FLAKY - Automated DevOps process requires fast and reliable feedback and it cannot be provided by tools like Appium. Tests written with native tools are much less flaky.
  • IT IS EASY TO SETUP - Setup process on local machine is easier than Appium, android developers feel most comfortable in the mobile SDK language which they use every day.
  • IT GIVES MORE CONTROL OVER THE APPLICATION - it is white box testing, Espresso is inside the application, it has access to and knows how to use the code that actually runs the application for more thorough testing of each element.


Appium is cross-platform tool used by big number of people and it definitely has its pluses like supporting multiple programming languages, no need to recompile application. It is also easy to learn and work with.

The main thesis put forward by the supporters of Appium is that moving from Appium to Espresso or XCUITests makes it necessary to develope tests for both platforms in two custom languages as well as maintaining twice the number of tests. In reality Appium uses XCUI and UIAutomator (part of android test library which also includes espresso) and for testing cross platform apps there will always be some degree of technical complexity involved with Appium.

In Appium's framework we may have custom page objects, helpers for these platforms, maintaining them is not easier than maintaining two custom frameworks.
Changes in android and iOS platforms accelerated last time and Appium is often late when changes are done in mentioned ones what means we have delays in our day-to-day testing. Also android experience is supposed to be different to the iOS experience, framework becomes complicated to handle both of them.

Software testing services need highly productive new technologies that are aligned with the organization's strategic objectives. There are more pro's than con's on switching to Espresso and disadvantages can be mitigated by using proper libraries (page objects) and reducing test code to several simple self-descripting lines.


Simply download latest Android Studio and follow any commonly available tutorials like this one. You can execute your tests on real device connected with USB cable or built-in android emulator both from Android Studio as well as command line.

DevOps Testing Applications Mobile Developer Knowledge Share