UiAutomatorTest

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

 

Fields

protected Collection<ITestRunListener> mListeners

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

Fields

mListeners

Collection<ITestRunListener> mListeners

Public constructors

UiAutomatorTest

UiAutomatorTest ()

Public methods

addClassName

void addClassName (String className)

Add a test class name to run.

Parameters
className String

addClassNames

void addClassNames (Collection<String> classNames)

Add a test class name collection to run.

Parameters
classNames Collection

addRunArg

void addRunArg (String key, 
                String value)

Add an argument to provide when running the UI Automator tests

Parameters
key String: the argument name
value String: the argument value

getClassNames

List<String> getClassNames ()

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

Returns
List<String> list of test class names

getDevice

ITestDevice getDevice ()

Get the device under test.

Returns
ITestDevice the ITestDevice

getSyncTime

long getSyncTime ()

Returns
long the time allocated for the tests to sync.

getTestJarPaths

List<String> getTestJarPaths ()

Returns
List<String> the test jar path.

getTestRunArgMap

Map<String, String> getTestRunArgMap ()

Returns
Map<String, String> the arguments map to pass to the UiAutomatorRunner.

getTestRunner

IRemoteAndroidTestRunner getTestRunner ()

Returns
IRemoteAndroidTestRunner the test runner.

isInstrumentationTest

boolean isInstrumentationTest ()

Returns
boolean

run

void run (ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

Parameters
listener ITestInvocationListener: the ITestInvocationListener of test results
Throws
DeviceNotAvailableException

setCaptureLogs

void setCaptureLogs (boolean captureLogs)

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

Retained for compatibility with cts-tradefed

Parameters
captureLogs boolean

setDevice

void setDevice (ITestDevice device)

Inject the device under test.

Parameters
device ITestDevice: the ITestDevice to use

setLoggingOption

void setLoggingOption (UiAutomatorTest.LoggingOption loggingOption)

Parameters
loggingOption UiAutomatorTest.LoggingOption

setRunName

void setRunName (String runName)

Parameters
runName String

setRunnerName

void setRunnerName (String runnerName)

Parameters
runnerName String

setSyncTime

void setSyncTime (long syncTime)

Parameters
syncTime long: the time for the tests files to sync.

setTestJarPaths

void setTestJarPaths (List<String> jarPaths)

Parameters
jarPaths List: the locations of the test jars.

setTestRunArgMap

void setTestRunArgMap (Map<String, String> runArgMap)

Parameters
runArgMap Map: the arguments to pass to the UiAutomatorRunner.

Protected methods

createTestRunner

IRemoteAndroidTestRunner createTestRunner ()

Returns
IRemoteAndroidTestRunner

getRunUtil

IRunUtil getRunUtil ()

Returns
IRunUtil

onScreenshotAndBugreport

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

Parameters
device ITestDevice
listener ITestInvocationListener
prefix String

onScreenshotAndBugreport

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

Parameters
device ITestDevice
listener ITestInvocationListener
prefix String
overrideAction UiAutomatorTest.TestFailureAction

preTestSetup

void preTestSetup ()

Checks if the UI Automator components are present on device

Throws
DeviceNotAvailableException