UiAutomatorTest
public
class
UiAutomatorTest
extends Object
implements
IDeviceTest,
IRemoteTest,
ITestFilterReceiver
java.lang.Object | |
↳ | com.android.tradefed.testtype.UiAutomatorTest |
Summary
Fields | |
---|---|
protected
|
mListeners
|
Public constructors | |
---|---|
UiAutomatorTest()
|
Public methods | |
---|---|
void
|
addAllExcludeFilters(
Adds the |
void
|
addAllIncludeFilters(
Adds the |
void
|
addClassName(String className)
Add a test class name to run. |
void
|
addClassNames(
Add a test class name collection to run. |
void
|
addExcludeFilter(String filter)
Adds a filter of which tests to exclude. |
void
|
addIncludeFilter(String filter)
Adds a filter of which tests to include. |
void
|
addRunArg(String key, String value)
Add an argument to provide when running the UI Automator tests |
void
|
clearExcludeFilters()
Delete all the exclude filters currently tracked. |
void
|
clearIncludeFilters()
Delete all the include filters currently tracked. |
|
getClassNames()
Gets the list of test class names that the harness is configured to run |
ITestDevice
|
getDevice()
Get the device under test. |
|
getExcludeFilters()
Returns the current |
|
getIncludeFilters()
Returns the current |
long
|
getSyncTime()
|
|
getTestJarPaths()
|
|
getTestRunArgMap()
|
IRemoteAndroidTestRunner
|
getTestRunner()
|
boolean
|
isInstrumentationTest()
|
void
|
run(TestInformation testInfo, ITestInvocationListener listener)
Runs the tests, and reports result to the listener. |
void
|
setCaptureLogs(boolean captureLogs)
This method is deprecated.
use |
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(
|
void
|
setTestRunArgMap(
|
Protected methods | |
---|---|
IRemoteAndroidTestRunner
|
createTestRunner()
|
IRunUtil
|
getRunUtil()
|
void
|
onScreenshotAndBugreport(ITestDevice device, ITestInvocationListener listener, String prefix, UiAutomatorTest.TestFailureAction overrideAction)
|
void
|
onScreenshotAndBugreport(ITestDevice device, ITestInvocationListener listener, String prefix)
|
void
|
preTestSetup()
Checks if the UI Automator components are present on device |
Fields
mListeners
protectedmListeners
Public constructors
UiAutomatorTest
public UiAutomatorTest ()
Public methods
addAllExcludeFilters
public void addAllExcludeFilters (filters)
Adds the ERROR(/Set)
of filters of which tests to exclude.
Parameters | |
---|---|
filters |
|
addAllIncludeFilters
public void addAllIncludeFilters (filters)
Adds the ERROR(/Set)
of filters of which tests to include.
Parameters | |
---|---|
filters |
|
addClassName
public void addClassName (String className)
Add a test class name to run.
Parameters | |
---|---|
className |
String |
addClassNames
public void addClassNames (classNames)
Add a test class name collection to run.
Parameters | |
---|---|
classNames |
|
addExcludeFilter
public void addExcludeFilter (String filter)
Adds a filter of which tests to exclude.
Parameters | |
---|---|
filter |
String |
addIncludeFilter
public void addIncludeFilter (String filter)
Adds a filter of which tests to include.
Parameters | |
---|---|
filter |
String |
addRunArg
public 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 |
clearExcludeFilters
public void clearExcludeFilters ()
Delete all the exclude filters currently tracked.
clearIncludeFilters
public void clearIncludeFilters ()
Delete all the include filters currently tracked.
getClassNames
publicgetClassNames ()
Gets the list of test class names that the harness is configured to run
Returns | |
---|---|
|
list of test class names |
getDevice
public ITestDevice getDevice ()
Get the device under test.
Returns | |
---|---|
ITestDevice |
the ITestDevice |
getExcludeFilters
publicgetExcludeFilters ()
Returns the current ERROR(/Set)
of exclude filters.
Returns | |
---|---|
|
getIncludeFilters
publicgetIncludeFilters ()
Returns the current ERROR(/Set)
of include filters.
Returns | |
---|---|
|
getSyncTime
public long getSyncTime ()
Returns | |
---|---|
long |
the time allocated for the tests to sync. |
getTestJarPaths
publicgetTestJarPaths ()
Returns | |
---|---|
|
the test jar path. |
getTestRunArgMap
publicgetTestRunArgMap ()
Returns | |
---|---|
|
the arguments map to pass to the UiAutomatorRunner. |
getTestRunner
public IRemoteAndroidTestRunner getTestRunner ()
Returns | |
---|---|
IRemoteAndroidTestRunner |
the test runner. |
isInstrumentationTest
public boolean isInstrumentationTest ()
Returns | |
---|---|
boolean |
run
public void run (TestInformation testInfo, ITestInvocationListener listener)
Runs the tests, and reports result to the listener.
Parameters | |
---|---|
testInfo |
TestInformation : The TestInformation object containing useful information to run
tests. |
listener |
ITestInvocationListener : the ITestInvocationListener of test results |
Throws | |
---|---|
DeviceNotAvailableException |
setCaptureLogs
public void setCaptureLogs (boolean captureLogs)
This method is deprecated.
use setLoggingOption(com.android.tradefed.testtype.UiAutomatorTest.LoggingOption)
instead.
Parameters | |
---|---|
captureLogs |
boolean |
setDevice
public void setDevice (ITestDevice device)
Inject the device under test.
Parameters | |
---|---|
device |
ITestDevice : the ITestDevice to use |
setLoggingOption
public void setLoggingOption (UiAutomatorTest.LoggingOption loggingOption)
Parameters | |
---|---|
loggingOption |
UiAutomatorTest.LoggingOption |
setRunName
public void setRunName (String runName)
Parameters | |
---|---|
runName |
String |
setRunnerName
public void setRunnerName (String runnerName)
Parameters | |
---|---|
runnerName |
String |
setSyncTime
public void setSyncTime (long syncTime)
Parameters | |
---|---|
syncTime |
long : the time for the tests files to sync. |
setTestJarPaths
public void setTestJarPaths (jarPaths)
Parameters | |
---|---|
jarPaths |
: the locations of the test jars. |
setTestRunArgMap
public void setTestRunArgMap (runArgMap)
Parameters | |
---|---|
runArgMap |
: the arguments to pass to the UiAutomatorRunner. |
Protected methods
createTestRunner
protected IRemoteAndroidTestRunner createTestRunner ()
Returns | |
---|---|
IRemoteAndroidTestRunner |
Throws | |
---|---|
DeviceNotAvailableException |
onScreenshotAndBugreport
protected void onScreenshotAndBugreport (ITestDevice device, ITestInvocationListener listener, String prefix, UiAutomatorTest.TestFailureAction overrideAction)
Parameters | |
---|---|
device |
ITestDevice |
listener |
ITestInvocationListener |
prefix |
String |
overrideAction |
UiAutomatorTest.TestFailureAction |
onScreenshotAndBugreport
protected void onScreenshotAndBugreport (ITestDevice device, ITestInvocationListener listener, String prefix)
Parameters | |
---|---|
device |
ITestDevice |
listener |
ITestInvocationListener |
prefix |
String |
preTestSetup
protected void preTestSetup ()
Checks if the UI Automator components are present on device
Throws | |
---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |