Using Espresso for Fast and Reliable Feedback

/, Mobile Application Development, Mobile Application Testing/Using Espresso for Fast and Reliable Feedback

Last week, we hosted a webinar on Espresso, the UI testing framework for Android native apps. As an introductory, it was great to see a mix of experiences and skill sets in the audience

We chose this topic because we see many customers interested in using Espresso, migrating from other frameworks, and combining testing technologies to include more testing in every build cycle.

Questions:

Daniel: “What’s your opinion about using UIAutomator with Espresso? It’s a good practice?”

Answer: Espresso is great for testing app functionality, but is built to stop at the app/OS boundary. UIAutomator is great for controlling system properties. Google documents their individual usefulness here.

They *can be combined, as Alex Zhukovich explains in this article, but my personal opinion is that you should be careful of how much your Espresso tests depend on outside the app, to keep them fast and flakiness-free across platform versions. In cases where you *need to perform activities in Espresso code that are outside the default scope of the framework, be VERY clear about what/why you’re doing it (i.e. step up your documentation/commenting game in those cases).

UIAutomator also requires Android 4.3 (API level 18) or higher. If that’s not a problem for you, fantastic. If it is, you’ll probably need to adjust your test execution strategy to accommodate for maximum test and platform coverage in both cases.

Another great resource is the work Chiu-ki Chan has done around explaining and demonstrating various aspects of Espresso testing. She touches on UIAutomator in this video, and goes into depth about Intents, Idling, Dagger and Mockito use with Espresso here.

Tamish: “Is it possible to use espresso for apps build on Xamarin?”

Answer: Yes! Recently our good friend Donovan Brown was on Channel9 about how to use Espresso to test Xamarin apps. You can watch the presentation here.

Santosh: “Does Espresso support XPath at all?”

Answer: Yes, but Espresso tends to prefer utility functions for matching elements by properties, not path. Nevertheless, there are a few methods for XPath, as documented here.

Kiruthika: “Will it support IOS builds too?”

Answer: No. Espresso is for Android native apps only.

Lauren: “What integrations do you know for cucumber and Espresso?”

Answer: Good question! Others have driven Espresso execution using Cucumber and like every Cucumber implementation, it requires glue code, mapping of app identifiers and test actions. Here’s a great article by Alex Fogleman about how to do this. There are also numerous Github examples on the topic

[ref] [ref]

Espresso, the Testing Trend

Organizations are optimizing what technologies they use to ensure app quality, but they’re also optimizing the process of development by testing earlier and more often. Espresso helps development teams create and execute stable tests quickly, but speed and reliability depend on the infrastructure you use as well.

Perfecto’s industry-leading Continuous Quality Lab helps development teams streamline feedback on the health and quality of their apps by simplifying what it takes to test on real devices, platforms, environments, and under real user conditions.

The full recording of last week’s webinar can be found on our YouTube channel, and slides can be found here.

Related:

Paul Bruce is a Developer Evangelist at Perfecto, focusing on the value of quality and velocity throughout the software lifecycle. He previously worked as an advocate for API development and testing practices and as a full stack developer before that. He now writes, speaks, listens, and teaches about software delivery patterns in modern enterprises and key industries around the world.

Leave A Comment