Book Image

Android Application Development with Maven

Book Image

Android Application Development with Maven

Overview of this book

Table of Contents (14 chapters)

Running Android instrumentation tests


Android uses, like we already saw, JUnit 3. It is the underlying framework to support instrumentation testing execution. All the tests you will write need to extend one of the following classes that extend the basic class ActivityTestCase:

  • ActivityInstrumentationTestCase2: This class is used for running activity tests

  • ProviderTestCase2: This class is used for running tests of content providers and making sure that your tests always run against a clean dataset

  • ServiceTestCase: This class is used for validating the various states of your services

Tip

Keep in mind also that each of the previously mentioned base test classes provide specific methods and features that facilitate the testing of their target components.

Creating a dedicated integration testing module

Our first step is to create a new dedicated Maven module that will host our instrumentation test cases. You should by now be able to create a new Maven module but for clarity we include the series...