Skip to content

Most visited

Recently visited

navigation

ActivityTestCase

public abstract class ActivityTestCase
extends InstrumentationTestCase

java.lang.Object
   ↳ junit.framework.Assert
     ↳ junit.framework.TestCase
       ↳ android.test.InstrumentationTestCase
         ↳ android.test.ActivityTestCase
Known Direct Subclasses


This class was deprecated in API level 24.
New tests should be written using the Android Testing Support Library.

This is common code used to support Activity test cases. For more useful classes, please see ActivityUnitTestCase and ActivityInstrumentationTestCase.

Summary

Public constructors

ActivityTestCase()

Protected methods

Activity getActivity()
void scrubClass(Class<?> testCaseClass)

This function is called by various TestCase implementations, at tearDown() time, in order to scrub out any class variables.

void setActivity(Activity testActivity)

Set the activity under test.

Inherited methods

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

ActivityTestCase

Added in API level 1
ActivityTestCase ()

Protected methods

getActivity

Added in API level 1
Activity getActivity ()

Returns
Activity Returns the activity under test.

scrubClass

Added in API level 1
void scrubClass (Class<?> testCaseClass)

This function is called by various TestCase implementations, at tearDown() time, in order to scrub out any class variables. This protects against memory leaks in the case where a test case creates a non-static inner class (thus referencing the test case) and gives it to someone else to hold onto.

Parameters
testCaseClass Class: The class of the derived TestCase implementation.
Throws
IllegalAccessException

setActivity

Added in API level 1
void setActivity (Activity testActivity)

Set the activity under test.

Parameters
testActivity Activity: The activity under test
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.