19

For last few weeks, I was using Appium(python) for android testing but yesterday we have decided to shift to Expresso(Java) for automated testing. There are couple of reasons why we are making this shift:

  • We want to scale out our automated testing, and there are lot of features not present in appium.

  • This is one of the latest testing framework for android, and has nice backward compatibility.

  • Small API and very easy to customize.

I have been reading for Espresso but I don't find anything great at all, If I compare it with Appium. I am a Python/R developer so maybe there are couple of points I am not able to understand. Would anyone like to help me understand if the shift to this new testing framework will be good for future? I am missing the bigger picture here, and any help would be greatly appreciated.

1
  • 1
    don't forget to share your experience/impressions
    – kiedysktos
    Sep 30, 2016 at 11:33

4 Answers 4

17
  1. The Shifting will be very much useful as Espresso supports testing activities outside the app like camera, browser and dialer etc which appium does not support.
  2. Espresso you can test toast message, auto complete and dialogs which are outside app.
  3. With Espresso Test Suit you can find code coverage and measure your testing efforts.
4
  • 4
    I'm not sure you can test things outside of your app with Espresso. For that you would need to use something like ui-automator. See developer.android.com/training/testing/ui-testing/… and developer.android.com/training/testing/ui-testing/… Aug 13, 2016 at 23:05
  • 2
    @YairKukielka That's true, Espresso does not support testing outside the app but it can work in tandem with UiAutomator. So, in the same test code, you can write Espresso as well as UiAutomator and so test in as well as outside the app. Reference: plus.google.com/+AndroidDevelopers/posts/WCWANrPkRxg
    – user846316
    Sep 28, 2016 at 8:33
  • 2
    you can use Espresso Intent to test Camera and phone's dialer activity outside of your app.That's what I meant in my answer.
    – anuja jain
    Sep 28, 2016 at 11:19
  • One of the most important points in my opinion: You just can just test end-to-end / on integration level with Appium. These tend to be indeterministic, rendering the tests more or less useless in my opinion. Failures of the tests are hard to investigate. Furthermore: With complex workflows or with an increasing number of tests they simply don't scale. The solution would be to test component-wise (e.g. per Activity) which is much faster, reliable, traceable, adaptable (mochable), and so on. You can't do that with Appium.
    – nepa
    Jun 19, 2017 at 13:38
13

You can go to Espresso if you're sticking only to Android automation and have no idea of automating iOS.

AFIKW, Espresso needs source code of the app in order to automate it.

Advantage is, it's directly open-sourced by google.

But my go is to go with Appium since its a large open sourced community with huge enhancements on its way and easy to automate with any programming language and needless to say it supports both Android and iOS.

3
  • 3
    I Agree with your views. Aug 26, 2016 at 10:49
  • 1
    Can you clarify what you mean by 'huge enhancements on its way"? I was unable to find much of significance.
    – olevegard
    Sep 22, 2016 at 13:53
  • i think appium support very low api level still now its only 5.0, which is something not good.
    – bj4947
    Dec 13, 2016 at 22:59
8

I agree that Espresso may be be very efficient when it comes to Android testing solely. For example, it can run only the activity it's testing, which is great.

Still, I stick to the Appium because it has the same API for both AndroidDriver and iOSDriver. Usually Android apps are accompanied by iOS apps, and if you're responsible for the UI automation, you have to take overall costs into account.

Appium has following advantages over platform-specific solution:

  • Android and iOS tests can share many classes, including helper methods and configuration,
  • Android and iOS tests can share common tests logic on higher level, while having different or slightly different implementation on lower level (for example sometimes I can just copy whole page object class and make simple change of locators in order to make it work on the other platform),
  • same API enables us to seamlessly switch between the iOS and Android test development in a team. Easy switching to Selenium for Web development is additional benefit.

The biggest disadvantage of Appium is the speed of longer test scenarios and some difficulties in locating elements, but still it's my choice.

As the side note, I'd like to add that you shouldn't forget about the test pyramid which refers to test automation. Please keep balance between Unit Tests, Integration tests and UI tests http://martinfowler.com/bliki/TestPyramid.html

1
  • What would you recommend in terms of stability and long-term maintenance cost? Appium or Espresso? Oct 21, 2017 at 16:10
6

The main difference between the two is,

Espresso test is within the application and it is aware of all the layers of the application. So you can mock certain layers of app, more like a white-box testing

Appium tests are black-box, tests know only the UI layer of the app. Main advantage is for cross-platform testing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.