Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Testing: UIAutomator vs Espresso

I was seeking for test frameworks for Android UI automation and I stumbled upon UI Automator and Espresso and this is the part I am confused about -

  1. Both are maintained by Google
  2. Both are used for functional UI testing
  3. Both are Android only frameworks

So my questions/doubts here are -

  • What is the major difference between UI Automator and Espresso?
  • Will the source code have to be modified to integrate any of these frameworks?
  • Does one framework hold any advantage over the other? If yes, then which framework is the most suitable for UI automation of an Android app?
like image 912
Shikhar Avatar asked Jun 26 '15 14:06

Shikhar


People also ask

Is UIAutomator deprecated?

This class is deprecated. It is no longer necessary to extend UiAutomatorTestCase.

Which is better espresso or Appium?

Overall, Espresso is much more stable than Appium for automated Android UI testing. In addition to that, the execution of test scripts is much faster.

Which framework is best for Appium testing?

In general, Appium and Calabash are good cross-platform frameworks in testing both your Android and iOS versions at the same time. Espresso is a good choice if you are purely testing Android apps. Therefore, think about your testing need – functional testing, compatibility testing, UI testing, etc.

What is espresso testing in Android?

Espresso is an open source android user interface (UI) testing framework developed by Google. The term Espresso is of Italian origin, meaning Coffee. Espresso is a simple, efficient and flexible testing framework.


1 Answers

Actually, you don't need to choose. UIAutomator and Espresso use the same instrumentation runner, so you can use commands from both of them in a single test. Espresso has variety of matchers, assertions and actions on UI, that automator doesn't have:

Espresso Cheat Sheet

Espresso is running in separate thread and it is really fast comparing to other test frameworks.

as Summary: use both of them in your tests, Espresso is main and UIAutomator as an additional tool for OS integration.

like image 185
Dmitry Gr Avatar answered Oct 06 '22 00:10

Dmitry Gr