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 the remote device to interact with: run test, collect results etc
jarPaths 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 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)

public void addInstrumentationArg (String name, String value)

public void cancel ()

public String getPackageName ()

Returns the package name of last Java class added

public String getRunnerName ()

Returns default UiAutomatorTestRunner class name

public void removeInstrumentationArg (String name)

public void run (Collection<ITestRunListener> listeners)

Throws
TimeoutException
AdbCommandRejectedException
ShellCommandUnresponsiveException
IOException

public void run (ITestRunListener... listeners)

Throws
TimeoutException
AdbCommandRejectedException
ShellCommandUnresponsiveException
IOException

public void setClassName (String className)

public void setClassNames (String[] classNames)

public void setCoverage (boolean coverage)

public void setDebug (boolean debug)

public void setIgnoreSighup (boolean value)

Sets the option in the uiautomator to ignore SIGHUP.

Parameters
value ignore the signal if set to true

public void setLogOnly (boolean logOnly)

public void setMaxTimeToOutputResponse (long timeout, TimeUnit unit)

public void setMaxtimeToOutputResponse (int maxTimeToOutputResponse)

public void setMethodName (String className, String testName)

public void setRunName (String runName)

public void setTestCollection (boolean b)

public void setTestPackageName (String packageName)

public void setTestSize (IRemoteAndroidTestRunner.TestSize size)

Protected Methods

protected String getRunCommand ()

protected String getRunnerPath ()