UiAutomatorTest
public
class
UiAutomatorTest
extends Object
implements
IDeviceTest,
IRemoteTest,
ITestFilterReceiver
| java.lang.Object | |
| ↳ | com.android.tradefed.testtype.UiAutomatorTest |
Summary
Fields | |
|---|---|
protected
Collection<ITestLifeCycleReceiver> |
mListeners
|
Public constructors | |
|---|---|
UiAutomatorTest()
|
|
Public methods | |
|---|---|
void
|
addAllExcludeFilters(Set<String> filters)
Adds the |
void
|
addAllIncludeFilters(Set<String> filters)
Adds the |
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
|
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. |
List<String>
|
getClassNames()
Gets the list of test class names that the harness is configured to run |
ITestDevice
|
getDevice()
Get the device under test. |
Set<String>
|
getExcludeFilters()
Returns the current |
Set<String>
|
getIncludeFilters()
Returns the current |
long
|
getSyncTime()
|
List<String>
|
getTestJarPaths()
|
Map<String, String>
|
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(List<String> jarPaths)
|
void
|
setTestRunArgMap(Map<String, String> runArgMap)
|
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
Public constructors
UiAutomatorTest
public UiAutomatorTest ()
Public methods
addAllExcludeFilters
public void addAllExcludeFilters (Set<String> filters)
Adds the Set of filters of which tests to exclude.
| Parameters | |
|---|---|
filters |
Set |
addAllIncludeFilters
public void addAllIncludeFilters (Set<String> filters)
Adds the Set of filters of which tests to include.
| Parameters | |
|---|---|
filters |
Set |
addClassName
public void addClassName (String className)
Add a test class name to run.
| Parameters | |
|---|---|
className |
String |
addClassNames
public void addClassNames (Collection<String> classNames)
Add a test class name collection to run.
| Parameters | |
|---|---|
classNames |
Collection |
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
public 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
public ITestDevice getDevice ()
Get the device under test.
| Returns | |
|---|---|
ITestDevice |
the ITestDevice |
getExcludeFilters
public Set<String> getExcludeFilters ()
Returns the current Set of exclude filters.
| Returns | |
|---|---|
Set<String> |
|
getIncludeFilters
public Set<String> getIncludeFilters ()
Returns the current Set of include filters.
| Returns | |
|---|---|
Set<String> |
|
getSyncTime
public long getSyncTime ()
| Returns | |
|---|---|
long |
the time allocated for the tests to sync. |
getTestJarPaths
public List<String> getTestJarPaths ()
| Returns | |
|---|---|
List<String> |
the test jar path. |
getTestRunArgMap
public Map<String, String> getTestRunArgMap ()
| Returns | |
|---|---|
Map<String, String> |
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(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 (List<String> jarPaths)
| Parameters | |
|---|---|
jarPaths |
List: the locations of the test jars. |
setTestRunArgMap
public void setTestRunArgMap (Map<String, String> runArgMap)
| Parameters | |
|---|---|
runArgMap |
Map: 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 |
|