Screenshot Testing for Android to discover UI regressions

Testing on Android has come a long way over the past few years. Nowadays tools like Mockito and Espresso make it easy to write unit and UI tests for Android. At Runtastic, our Android engineers share a lot of UI components across our apps. With screenshot testing, we can test our UI components against visual regressions under various conditions. In this blog post, we’ll show you how that works and how you can apply screenshot testing for your projects too.

How does screenshot testing work in general?

Screenshot testing uses instrumented UI tests to render a screen or a portion of a screen to an image. This image is then compared to a “reference image”. If both images are equal, the test succeeds — otherwise it fails.

A screenshot test is quite similar to a UI test. The only difference is that for assertion the rendered image is compared to a reference image.

Introducing the screenshot testing library

At the moment, the Android Testing Support Library does not offer any tool to perform screenshot tests.

Read full story on

Like what you read? Give Runtastic a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.