public abstract class

ActivityInstrumentationTestCase

extends ActivityTestCase
java.lang.Object
   ↳ junit.framework.Assert
     ↳ junit.framework.TestCase
       ↳ android.test.InstrumentationTestCase
         ↳ android.test.ActivityTestCase
           ↳ android.test.ActivityInstrumentationTestCase<T extends android.app.Activity>

This class is deprecated.new tests should be written using ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test

Class Overview

This class provides functional testing of a single activity. The activity under test will be created using the system infrastructure (by calling InstrumentationTestCase.launchActivity()) and you will then be able to manipulate your Activity directly. Most of the work is handled automatically here by setUp() and tearDown().

If you prefer an isolated unit test, see ActivityUnitTestCase.

Summary

Public Constructors
ActivityInstrumentationTestCase(String pkg, Class<T> activityClass)
NOTE: The parameter pkg must refer to the package identifier of the package hosting the activity to be launched, which is specified in the AndroidManifest.xml file.
ActivityInstrumentationTestCase(String pkg, Class<T> activityClass, boolean initialTouchMode)
NOTE: The parameter pkg must refer to the package identifier of the package hosting the activity to be launched, which is specified in the AndroidManifest.xml file.
Public Methods
T getActivity()
void testActivityTestCaseSetUpProperly()
Protected Methods
void setUp()
Sets up the fixture, for example, open a network connection.
void tearDown()
Make sure all resources are cleaned up and garbage collected before moving on to the next test.
[Expand]
Inherited Methods
From class android.test.ActivityTestCase
From class android.test.InstrumentationTestCase
From class junit.framework.TestCase
From class junit.framework.Assert
From class java.lang.Object
From interface junit.framework.Test

Public Constructors

public ActivityInstrumentationTestCase (String pkg, Class<T> activityClass)

NOTE: The parameter pkg must refer to the package identifier of the package hosting the activity to be launched, which is specified in the AndroidManifest.xml file. This is not necessarily the same as the java package name.

Parameters
pkg The package hosting the activity to be launched.
activityClass The activity to test.

public ActivityInstrumentationTestCase (String pkg, Class<T> activityClass, boolean initialTouchMode)

NOTE: The parameter pkg must refer to the package identifier of the package hosting the activity to be launched, which is specified in the AndroidManifest.xml file. This is not necessarily the same as the java package name.

Parameters
pkg The package hosting the activity to be launched.
activityClass The activity to test.
initialTouchMode true = in touch mode

Public Methods

public T getActivity ()

Returns
  • Returns the activity under test.

public void testActivityTestCaseSetUpProperly ()

Throws
Exception

Protected Methods

protected void setUp ()

Sets up the fixture, for example, open a network connection. This method is called before a test is executed.

Throws
Exception

protected void tearDown ()

Make sure all resources are cleaned up and garbage collected before moving on to the next test. Subclasses that override this method should make sure they call super.tearDown() at the end of the overriding method.

Throws
Exception