| java.lang.Object | ||
| ↳ | android.app.Instrumentation | |
| ↳ | android.support.test.orchestrator.AndroidTestOrchestrator | |
An Instrumentation that executes other instrumentations.
Takes parameters targetPackage and targetInstrumentation, and executes that
instrumentation with the same class parameters.
When run normally (i.e. without setting the isolated flag to false) the on device orchestrator will handle test collection and execution. The target instrumentation is executed via shell commands on the device, with one shell command for test collection, followed by one shell command per test.
Each test runs in its own isolated process with its own instrumentation.
The AndroidTestOrchestrator requires installation of a test services APK android.support.test.services, and the stubapp APK android.support.test.orchestrator.stubapp. The orchestrator is technically instrumenting the
stubapp, but it's real purpose is to issue commands to AndroidJUnitRunner or another instrumentation, to run your tests.
Whereas previously you might have called am instrument -w
com.example.app/android.support.test.runner.AndroidJUnitRunner you would now execute 'CLASSPATH=$(pm path android.support.test.services) app_process /
android.support.test.services.shellexecutor.ShellMain am instrument -w -e targetInstrumentation
com.example.app/android.support.test.runner.AndroidJUnitRunner
android.support.test.orchestrator/android.support.test.orchestrator.AndroidTestOrchestrator'
All flags besides the ones listed below are passed by the orchestrator to the target instrumentation.
Pass the -e isolated false flag if you wish the orchestrator to run all your tests in
a single process (as if you invoked the target instrumentation directly
Pass -e coverage true -e coverageFilePath /sdcard/foo/ flag to generate coverage files
in the given location (The app must have permission to write to the given location). The coverage
file naming convention will look like this com.foo.Class#method1.ec. Note, this is only
supported when running in isolated mode. Also, it cannot be used together with
AndroidJUnitRunner's coverageFile flag. Since the generated coverage files will overwrite
each other.
Pass -e clearPackageData flag if you wish the orchestrator to run pm clear
context.getPackageName() and pm clear targetContext.getPackageName() commands in between
test invocations. Note, the context in the clear command is the App under test context.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Invoked every time the TestRunnable finishes, including after test collection.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||||
|
| |||||||||||
|
| |||||||||||
| Parameters | |
|---|---|
obj |
Object |
e |
Throwable |
| Returns | |
|---|---|
boolean |
|
Invoked every time the TestRunnable finishes, including after test collection.