Skip to content

Android Testing Options

Nick Aiwazian edited this page Aug 18, 2015 · 9 revisions

Overview

Automated Testing is an important topic that helps us ensure quality when building Android apps. There are many different testing tools and frameworks we can use while developing Android apps. This guide will take a look at some of the more popular approaches available.

Unit Testing

Unit testing is about testing a particular component (i.e activity) in isolation of other components.

  • Robolectric - Popular Android unit test framework that allows faster test execution by running tests on the JVM (no device or emulator needed).
  • JUnit - Popular Java unit test framework. Most of the Android test frameworks are built on top of JUnit.

Instrumentation Testing

  • Espresso - Extensible Android UI Test Framework provided by Google that handles test synchronization very well.
  • UIAutomator - Android UI Test Framework provided by Google for testing across multiple apps at the same time.
  • Google Android Testing - This is the testing framework included as part of the platform (even Google doesn't seem to use this).
  • Robotium - Third party Android UI Test Framework (comparison with Espresso).
  • Selendroid - Selenium for Android.

Validation Frameworks

  • Assertj-Android - An extension of AssertJ (fluent assertions for Java) extended for Android (formerly known as FEST Android).
  • MoreAsserts - Extension of JUnit assertions to add assertions for sets, lists, etc.
  • ViewAsserts - Platform provided helper methods to validate view layout.

Mocking Frameworks

  • Mockito - Popular mocking framework for Java unit testing.
  • EasyMock - Mocking framework that also has record / replay support.

Other

  • MonkeyRunner - API Toolkit that allows controlling the Android device from Python code.
  • Monkey - Program that runs on the device and does random clicks, typing text, etc.
  • Cloud Test Lab - Large bank of devices that you can submit your tests too and have them run across a large range of different devices.
  • Spoon - Run your tests across multiple devices at the same time and see aggregated reports.

Finding these guides helpful?

We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.

Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.

Clone this wiki locally