java.lang.Object | ||
↳ | android.app.Instrumentation | |
↳ | android.test.InstrumentationTestRunner |
An Instrumentation
that runs various types of TestCase
s against
an Android package (application). Typical usage:
TestCase
s that perform unit, functional, or performance tests
against the classes in your package. Typically these are subclassed from:
InstrumentationTestCase
.
InstrumentationTestCase
(and are not performance tests).
TestCase
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | REPORT_KEY_NAME_CLASS | If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the name of the current test class. | |||||||||
String | REPORT_KEY_NAME_TEST | If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the name of the current test. | |||||||||
String | REPORT_KEY_NUM_CURRENT | If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the sequence number of the current test. | |||||||||
String | REPORT_KEY_NUM_TOTAL | If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the total number of tests that are being run. | |||||||||
String | REPORT_KEY_STACK | If included in the status bundle sent to an IInstrumentationWatcher, this key identifies a stack trace describing an error or failure. | |||||||||
String | REPORT_VALUE_ID | This value, if stored with key REPORT_KEY_IDENTIFIER ,
identifies InstrumentationTestRunner as the source of the report. |
|||||||||
int | REPORT_VALUE_RESULT_ERROR | The test completed with an error. | |||||||||
int | REPORT_VALUE_RESULT_FAILURE | The test completed with a failure. | |||||||||
int | REPORT_VALUE_RESULT_OK | The test completed successfully. | |||||||||
int | REPORT_VALUE_RESULT_START | The test is starting. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Instrumentation
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Override this to define all of the tests to run in your package.
| |||||||||||
Override this to provide access to the class loader of your package.
| |||||||||||
Called when the instrumentation is starting, before any application code
has been loaded.
| |||||||||||
Method where the instrumentation thread enters execution.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class android.app.Instrumentation
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface android.test.TestSuiteProvider
|
If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the name of the current test class. This is sent with any status message describing a specific test being started or completed.
If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the name of the current test. This is sent with any status message describing a specific test being started or completed.
If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the sequence number of the current test. This is sent with any status message describing a specific test being started or completed.
If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the total number of tests that are being run. This is sent with all status messages.
If included in the status bundle sent to an IInstrumentationWatcher, this key identifies a stack trace describing an error or failure. This is sent with any status message describing a specific test being completed.
This value, if stored with key REPORT_KEY_IDENTIFIER
,
identifies InstrumentationTestRunner as the source of the report. This is sent with all
status messages.
The test completed with an error.
The test completed with a failure.
The test completed successfully.
The test is starting.
Override this to define all of the tests to run in your package.
Override this to provide access to the class loader of your package.
Called when the instrumentation is starting, before any application code
has been loaded. Usually this will be implemented to simply call
start()
to begin the instrumentation thread, which will then
continue execution in onStart()
.
If you do not need your own thread -- that is you are writing your
instrumentation to be completely asynchronous (returning to the event
loop so that the application can run), you can simply begin your
instrumentation here, for example call startActivity(Intent)
to
begin the appropriate first activity of the application.
arguments | Any additional arguments that were supplied when the instrumentation was started. |
---|
Method where the instrumentation thread enters execution. This allows
you to run your instrumentation code in a separate thread than the
application, so that it can perform blocking operation such as
sendKeySync(KeyEvent)
or startActivitySync(Intent)
.
You will typically want to call finish() when this function is done, to end your instrumentation.