public class

AndroidTestCase

extends TestCase
java.lang.Object
   ↳ junit.framework.Assert
     ↳ junit.framework.TestCase
       ↳ android.test.AndroidTestCase
Known Direct Subclasses

Class Overview

Extend this if you need to access Resources or other things that depend on Activity Context.

Summary

Fields
protected Context mContext
Public Constructors
AndroidTestCase()
Public Methods
Context getContext()
void setContext(Context context)
void testAndroidTestCaseSetupProperly()
Protected Methods
void scrubClass(Class<?> testCaseClass)
This function is called by various TestCase implementations, at tearDown() time, in order to scrub out any class variables.
void setUp()
Sets up the fixture, for example, open a network connection.
void tearDown()
Tears down the fixture, for example, close a network connection.
[Expand]
Inherited Methods
From class junit.framework.TestCase
From class junit.framework.Assert
From class java.lang.Object
From interface junit.framework.Test

Fields

protected Context mContext

Public Constructors

public AndroidTestCase ()

Public Methods

public Context getContext ()

public void setContext (Context context)

public void testAndroidTestCaseSetupProperly ()

Protected Methods

protected 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 The class of the derived TestCase implementation.

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 ()

Tears down the fixture, for example, close a network connection. This method is called after a test is executed.

Throws
Exception