to top
public class

UiAutomatorTest

extends Object
implements IRemoteTest IDeviceTest
java.lang.Object
   ↳ com.android.tradefed.testtype.UiAutomatorTest

Summary

Nested Classes
enum UiAutomatorTest.LoggingOption  
enum UiAutomatorTest.TestFailureAction  
Public Constructors
UiAutomatorTest()
Public Methods
void addClassName(String className)
Add a test class name to run.
void addClassNames(Collection<String> classNames)
Add a test class name collection to run.
void addRunArg(String key, String value)
Add an argument to provide when running the UI Automator tests
List<String> getClassNames()
Gets the list of test class names that the harness is configured to run
ITestDevice getDevice()
Get the device under test.
long getSyncTime()
List<String> getTestJarPaths()
Map<String, String> getTestRunArgMap()
IRemoteAndroidTestRunner getTestRunner()
boolean isInstrumentationTest()
void run(ITestInvocationListener listener)
Runs the tests, and reports result to the listener.
void setCaptureLogs(boolean captureLogs)
This method is deprecated. use setLoggingOption(LoggingOption) instead.

Retained for compatibility with cts-tradefed

void setDevice(ITestDevice device)
Inject the device under test.
void setLoggingOption(UiAutomatorTest.LoggingOption loggingOption)
void setRunName(String runName)
void setRunnerName(String runnerName)
void setSyncTime(long syncTime)
void setTestJarPaths(List<String> jarPaths)
void setTestRunArgMap(Map<String, String> runArgMap)
Protected Methods
IRemoteAndroidTestRunner createTestRunner()
IRunUtil getRunUtil()
void onScreenshotAndBugreport(ITestDevice device, ITestInvocationListener listener, String prefix)
void onScreenshotAndBugreport(ITestDevice device, ITestInvocationListener listener, String prefix, UiAutomatorTest.TestFailureAction overrideAction)
void preTestSetup()
Checks if the UI Automator components are present on device
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.testtype.IRemoteTest
From interface com.android.tradefed.testtype.IDeviceTest

Public Constructors

public UiAutomatorTest ()

Public Methods

public void addClassName (String className)

Add a test class name to run.

public void addClassNames (Collection<String> classNames)

Add a test class name collection to run.

public void addRunArg (String key, String value)

Add an argument to provide when running the UI Automator tests

Parameters
key the argument name
value the argument value

public List<String> getClassNames ()

Gets the list of test class names that the harness is configured to run

Returns
  • list of test class names

public ITestDevice getDevice ()

Get the device under test.

Returns

public long getSyncTime ()

Returns
  • the time allocated for the tests to sync.

public List<String> getTestJarPaths ()

Returns
  • the test jar path.

public Map<String, String> getTestRunArgMap ()

Returns
  • the arguments map to pass to the UiAutomatorRunner.

public IRemoteAndroidTestRunner getTestRunner ()

Returns
  • the test runner.

public boolean isInstrumentationTest ()

public void run (ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

Parameters
listener the ITestInvocationListener of test results

public void setCaptureLogs (boolean captureLogs)

This method is deprecated.
use setLoggingOption(LoggingOption) instead.

Retained for compatibility with cts-tradefed

public void setDevice (ITestDevice device)

Inject the device under test.

Parameters
device the ITestDevice to use

public void setLoggingOption (UiAutomatorTest.LoggingOption loggingOption)

public void setRunName (String runName)

public void setRunnerName (String runnerName)

public void setSyncTime (long syncTime)

Parameters
syncTime the time for the tests files to sync.

public void setTestJarPaths (List<String> jarPaths)

Parameters
jarPaths the locations of the test jars.

public void setTestRunArgMap (Map<String, String> runArgMap)

Parameters
runArgMap the arguments to pass to the UiAutomatorRunner.

Protected Methods

protected IRemoteAndroidTestRunner createTestRunner ()

protected IRunUtil getRunUtil ()

protected void onScreenshotAndBugreport (ITestDevice device, ITestInvocationListener listener, String prefix)

protected void onScreenshotAndBugreport (ITestDevice device, ITestInvocationListener listener, String prefix, UiAutomatorTest.TestFailureAction overrideAction)

protected void preTestSetup ()

Checks if the UI Automator components are present on device