to top
public class

UiAutomatorRunner

extends Object
implements IRemoteAndroidTestRunner
java.lang.Object
   ↳ com.android.tradefed.testtype.UiAutomatorRunner

Class Overview

Runs UI Automator test on device and reports results. UI Automator test is a dedicated test runner for running UI automation tests that utilizes UI Automator framework. The test runner on device emulates instrumentation test output format so that existing parsing code in ddmlib and TF can be reused. Essentially, this is a wrapper around this command: adb shell uiautomator runtest (jar files) -e class (test classes) ...

Summary

Public Constructors
UiAutomatorRunner(IDevice remoteDevice, String[] jarPaths, String runnerPath)
Create a UiAutomatorRunner for running UI automation tests
Public Methods
void addBooleanArg(String name, boolean value)
void addInstrumentationArg(String name, String value)
void cancel()
String getPackageName()
Returns the package name of last Java class added
String getRunnerName()
Returns default UiAutomatorTestRunner class name
void removeInstrumentationArg(String name)
void run(Collection<ITestRunListener> listeners)
void run(ITestRunListener... listeners)
void setClassName(String className)
void setClassNames(String[] classNames)
void setCoverage(boolean coverage)
void setDebug(boolean debug)
void setIgnoreSighup(boolean value)
Sets the option in the uiautomator to ignore SIGHUP.
void setLogOnly(boolean logOnly)
void setMaxTimeToOutputResponse(long timeout, TimeUnit unit)
void setMaxtimeToOutputResponse(int maxTimeToOutputResponse)
void setMethodName(String className, String testName)
void setRunName(String runName)
void setTestCollection(boolean b)
void setTestPackageName(String packageName)
void setTestSize(IRemoteAndroidTestRunner.TestSize size)
Protected Methods
String getRunCommand()
String getRunnerPath()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.ddmlib.testrunner.IRemoteAndroidTestRunner

Public Constructors

public UiAutomatorRunner (IDevice remoteDevice, String[] jarPaths, String runnerPath)

Create a UiAutomatorRunner for running UI automation tests

Parameters
remoteDevice IDevice: the remote device to interact with: run test, collect results etc
jarPaths String: the paths to jar files where UI Automator test cases are; the paths must be absolute or relative to /data/local/tmp/ on device
runnerPath String: alternative uiautomator runner to use, may be null and default will be used in this case

Public Methods

public void addBooleanArg (String name, boolean value)

Parameters
name String
value boolean

public void addInstrumentationArg (String name, String value)

Parameters
name String
value String

public void cancel ()

public String getPackageName ()

Returns the package name of last Java class added

Returns
String

public String getRunnerName ()

Returns default UiAutomatorTestRunner class name

Returns
String

public void removeInstrumentationArg (String name)

Parameters
name String

public void run (Collection<ITestRunListener> listeners)

Parameters
listeners Collection
Throws
TimeoutException
AdbCommandRejectedException
ShellCommandUnresponsiveException
IOException

public void run (ITestRunListener... listeners)

Parameters
listeners ITestRunListener
Throws
TimeoutException
AdbCommandRejectedException
ShellCommandUnresponsiveException
IOException

public void setClassName (String className)

Parameters
className String

public void setClassNames (String[] classNames)

Parameters
classNames String

public void setCoverage (boolean coverage)

Parameters
coverage boolean

public void setDebug (boolean debug)

Parameters
debug boolean

public void setIgnoreSighup (boolean value)

Sets the option in the uiautomator to ignore SIGHUP.

Parameters
value boolean: ignore the signal if set to true

public void setLogOnly (boolean logOnly)

Parameters
logOnly boolean

public void setMaxTimeToOutputResponse (long timeout, TimeUnit unit)

Parameters
timeout long
unit TimeUnit

public void setMaxtimeToOutputResponse (int maxTimeToOutputResponse)

Parameters
maxTimeToOutputResponse int

public void setMethodName (String className, String testName)

Parameters
className String
testName String

public void setRunName (String runName)

Parameters
runName String

public void setTestCollection (boolean b)

Parameters
b boolean

public void setTestPackageName (String packageName)

Parameters
packageName String

public void setTestSize (IRemoteAndroidTestRunner.TestSize size)

Parameters
size IRemoteAndroidTestRunner.TestSize

Protected Methods

protected String getRunCommand ()

Returns
String

protected String getRunnerPath ()

Returns
String