O'Reilly logo

Mastering Android Application Development by Antonio Pachón Ruiz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing on Android

A new functionality is not complete without being tested first. We, as developers, have fallen many times into the trap of submitting code changes without writing a passing test first, only to find that the expected behavior was broken on future iterations.

We learned the hard way that writing tests boosts our productivity, increases code quality, and helps us release more often. For this reason, Android provided several tools to help us test our apps from the early stages.

In the following two sections, we will talk about my favorite setup, Robolectric for unit testing and Espresso for integration testing.

Unit tests with Robolectric

Until Robolectric, writing unit tests meant that we had to run them on a real device or an emulator. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required