Google is committed to advancing racial equity for Black communities. See how.
Added in API level 1
Deprecated in API level 24

ActivityTestCase

abstract class ActivityTestCase : InstrumentationTestCase
kotlin.Any
   ↳ junit.framework.Assert
   ↳ junit.framework.TestCase
   ↳ android.test.InstrumentationTestCase
   ↳ android.test.ActivityTestCase

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

Summary

Public constructors

Protected methods

open Activity!

open Unit
scrubClass(testCaseClass: Class<*>!)

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

open Unit
setActivity(testActivity: Activity!)

Set the activity under test.

Inherited functions

Public constructors

<init>

ActivityTestCase()

Protected methods

getActivity

Added in API level 1
Deprecated in API level 24
protected open fun getActivity(): Activity!

Deprecated.

Return
Activity! Returns the activity under test.

scrubClass

Added in API level 1
Deprecated in API level 24
protected open fun scrubClass(testCaseClass: Class<*>!): Unit

Deprecated.

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.
Exceptions
java.lang.IllegalAccessException

setActivity

Added in API level 1
Deprecated in API level 24
protected open fun setActivity(testActivity: Activity!): Unit

Deprecated.

Set the activity under test.

Parameters
testActivity Activity!: The activity under test