Codementor Events

How I learned Espresso Android Testing

Published May 30, 2022
How I learned Espresso Android Testing

About me

I am a mobile app developer, creating applications for both Android and iOS.
Previously been using React Native to create cross-platform apps and recently transitioned to Android (Kotlin) development.

Why I wanted to learn Espresso Android Testing

I wanted to learn Android Espresso Testing because it offers full end-to-end testing in an easy to read syntax. It is supported, by default, on all Android devices.

The reason I want to learn automated testing on Android is to prevent regression bugs and make sure all functionality of the app works well, across various Android devices.

How I approached learning Espresso Android Testing

I looked up most information from the Android Developer website as well as StackOverflow and Google. My goal was to run tests on a cloud-based Espresso platform, called TestingBot, where the test can run on a variety of devices, since I only own one Android device.

The syntax is pretty easy to use, either in Java or Kotlin.

Challenges I faced

I had a RecyclerView where I wanted to verify if the last element in the list was present. Turns out Android Espresso does not support this by default and you need to import an extra library for this.

Key takeaways

It was pretty easy to set up and start running Android Espresso, once you learn the basic structure and syntax which is required. You'll get instant feedback with a description of what failed, together with a live view, or a video view, of the app that is being tested.

Tips and advice

I highly recommend giving Android Espresso a try. It offers most features necessary to do automated testing of Android apps.

Final thoughts and next steps

The next learning goal is to go over UIAutomator (2) and see how it can help with testing.

Discover and read more posts from Jochen D
get started
post commentsBe the first to share your opinion
Show more replies