to top
public class


extends Object
implements IDeviceTest IResumableTest IShardableTest @OptionClass(alias = "installed-instrumentation")

Class Overview

Runs all instrumentation found on current device.


String COVERAGE_TARGET_KEY the metric key name for the test coverage target value
private BugreportCollector.Freq mBugreportFrequency @Option(name = "bugreport-on-failure", description = "Sets which failed testcase events cause a bugreport to be collected. a bugreport after failed testcases. Note that there is _no feedback mechanism_ between the test runner and the bugreport collector, so use the EACH setting with due caution.")
private boolean mFallbackToSerialRerun @Option(name = "fallback-to-serial-rerun", description = "Rerun tests serially after rerun from file failed.")
private String mForceAbi @Option(name = "force-abi", description = "The abi to use, can be either 32 or 64.", importance =
private Map<String, String> mInstrArgMap @Option(name = "instrumentation-arg", description = "Additional instrumentation arguments to provide.")
private boolean mIsRerunMode @Option(name = "rerun", description = "Rerun unexecuted tests individually on same device if test run fails to complete.")
private boolean mIsResumeMode @Option(name = "resume", description = "Schedule unexecuted tests for resumption on another device if first device becomes unavailable.")
private boolean mLogcatOnFailures @Option(name = "logcat-on-failure", description = "take a logcat snapshot on every test failure.")
private int mMaxLogcatBytes @Option(name = "logcat-on-failure-size", description = "The max number of logcat data in bytes to capture when --logcat-on-failure is on. Should be an amount that can comfortably fit in memory.")
private boolean mReRunUsingTestFile @Option(name = "rerun-from-file", description = "Use test file instead of separate adb commands for each test when re-running instrumentations for tests that failed to run in previous attempts. ")
private int mReRunUsingTestFileAttempts @Option(name = "rerun-from-file-attempts", description = "Max attempts to rerun tests from file. -1 means rerun from file infinitely.")
private boolean mRebootBeforeReRun @Option(name = "reboot-before-rerun", description = "Reboot a device before re-running instrumentations.")
private String mRunner @Option(name = "runner", description = "Restrict tests executed to a specific instrumentation class runner. Installed instrumentations that do not have this runner will be skipped.")
private boolean mScreenshotOnFailure @Option(name = "screenshot-on-failure", description = "Take a screenshot on every test failure")
private boolean mSendCoverage @Option(name = "send-coverage", description = "Send coverage target info to test listeners.")
private int mShards @Option(name = "shards", description = "Split test run into this many parallel shards")
private long mShellTimeout @Option(name = "shell-timeout", description = "The defined timeout (in milliseconds) is used as a maximum waiting time when expecting the command output from the device. At any time, if the shell command does not output anything for a period longer than defined timeout the TF run terminates. For no timeout, set to 0.")
private String mTestClass @Option(name = "class", description = "Only run tests in specified class")
private String mTestPackageName @Option(name = "package", description = "Only run tests within this specific java package. Will be ignored if --class is set.")
private String mTestSize @Option(name = "size", description = "Restrict tests to a specific test size. One of \'small\', \'medium\', \'large\'", importance =
private int mTestTimeout @Option(name = "test-timeout", description = "Sets timeout (in milliseconds) that will be applied to each test. In the event of a test timeout it will log the results and proceed with executing the next test. For no timeout, set to 0.")
private Integer mTimeout @Option(name = "timeout", description = "Deprecated - Use \"shell-timeout\" or \"test-timeout\" instead.")
Public Constructors
Public Methods
ITestDevice getDevice()
Get the device under test.
boolean isResumable()
void run(ITestInvocationListener listener)
Runs the tests, and reports result to the listener.
void setDevice(ITestDevice device)
Inject the device under test.
Collection<IRemoteTest> split()
Shard the test into separately runnable chunks.
Inherited Methods
From class java.lang.Object
From interface
From interface
From interface
From interface


public static final String COVERAGE_TARGET_KEY

the metric key name for the test coverage target value

Constant Value: "coverage_target"


private BugreportCollector.Freq mBugreportFrequency

private boolean mFallbackToSerialRerun

private String mForceAbi

private Map<String, String> mInstrArgMap

private boolean mIsRerunMode

private boolean mIsResumeMode

private boolean mLogcatOnFailures

private int mMaxLogcatBytes

private boolean mReRunUsingTestFile

private int mReRunUsingTestFileAttempts

private boolean mRebootBeforeReRun

private String mRunner

private boolean mScreenshotOnFailure

private boolean mSendCoverage

private int mShards

private long mShellTimeout

private String mTestClass

private String mTestPackageName

private String mTestSize

private int mTestTimeout

private Integer mTimeout

Public Constructors

public InstalledInstrumentationsTest ()

Public Methods

public ITestDevice getDevice ()

Get the device under test.

ITestDevice the ITestDevice

public boolean isResumable ()


public void run (ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

listener ITestInvocationListener: the ITestInvocationListener of test results

public void setDevice (ITestDevice device)

Inject the device under test.

device ITestDevice: the ITestDevice to use

public Collection<IRemoteTest> split ()

Shard the test into separately runnable chunks.

This will be called before test execution, so injected dependencies (such as the ITestDevice for IDeviceTests) may be null.

Collection<IRemoteTest> a collection of subtests to be executed separately or null if test is not currently shardable