# Print output for @column tags ?> SingleLaunchActivityTestCase - Android SDK | Android Developers

Most visited


Recently visited


SingleLaunchActivityTestCase

public abstract class SingleLaunchActivityTestCase
extends InstrumentationTestCase

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


This class is deprecated.
Use ActivityTestRule instead. New tests should be written using the Android Testing Support Library.

If you would like to test a single activity with an InstrumentationTestCase, this provides some of the boiler plate to launch and finish the activity in setUp() and tearDown(). This launches the activity only once for the entire class instead of doing it in every setup / teardown call.

Summary


Public constructors

SingleLaunchActivityTestCase(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.

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.

Inherited methods

Public constructors


SingleLaunchActivityTestCase

public SingleLaunchActivityTestCase (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 String: The package hosting the activity to be launched.

activityClass Class: The activity to test.

Public methods


getActivity

public T getActivity ()

Returns
T

testActivityTestCaseSetUpProperly

public void testActivityTestCaseSetUpProperly ()

Throws
Exception

Protected methods


setUp

protected void setUp ()

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

Throws
Exception

tearDown

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

Browse this site in English?

You requested a page in English, but your language preference for this site is English.

Would you like to change your language preference and browse this site in English? If you want to change your language preference later, use the language menu at the bottom of each page.