UiAutomator测试

public class UiAutomatorTest
extends Object implements IRemoteTest , IDeviceTest , ITestFilterReceiver

java.lang.Object
com.android.tradefed.testtype.UiAutomatorTest


概括

领域

protected mListeners

公共构造函数

UiAutomatorTest ()

公共方法

void addAllExcludeFilters ( filters) addAllExcludeFilters ( filters)

添加要排除的测试的过滤器的ERROR(/Set)

void addAllIncludeFilters ( filters) addAllIncludeFilters ( filters)

添加要包含的测试的过滤器的ERROR(/Set)

void addClassName (String className)

添加要运行的测试类名称。

void addClassNames ( classNames) addClassNames ( classNames)

添加要运行的测试类名称集合。

void addExcludeFilter (String filter)

添加要排除的测试的过滤器。

void addIncludeFilter (String filter)

添加要包含的测试的过滤器。

void addRunArg (String key, String value)

添加运行 UI Automator 测试时提供的参数

void clearExcludeFilters ()

删除当前跟踪的所有排除过滤器。

void clearIncludeFilters ()

删除当前跟踪的所有包含过滤器。

getClassNames ()

获取配置运行的测试类名称列表

ITestDevice getDevice ()

获取被测设备。

getExcludeFilters ()

返回排除过滤器的当前ERROR(/Set)

getIncludeFilters ()

返回包含过滤器的当前ERROR(/Set)

long getSyncTime ()
getTestJarPaths ()
getTestRunArgMap ()
IRemoteAndroidTestRunner getTestRunner ()
boolean isInstrumentationTest ()
void run ( TestInformation testInfo, ITestInvocationListener listener)

运行测试,并将结果报告给侦听器。

void setCaptureLogs (boolean captureLogs)

此方法已被弃用。使用setLoggingOption(com.android.tradefed.testtype.UiAutomatorTest.LoggingOption)代替。保留是为了与 cts-tradefed 兼容

void setDevice ( ITestDevice device)

注入被测设备。

void setLoggingOption ( UiAutomatorTest.LoggingOption loggingOption)
void setRunName (String runName)
void setRunnerName (String runnerName)
void setSyncTime (long syncTime)
void setTestJarPaths ( jarPaths) setTestJarPaths ( jarPaths)
void setTestRunArgMap ( runArgMap) setTestRunArgMap ( runArgMap)

受保护的方法

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 ()

检查设备上是否存在 UI Automator 组件

领域

mListeners

protected  mListeners

公共构造函数

UiAutomator测试

public UiAutomatorTest ()

公共方法

添加所有排除过滤器

public void addAllExcludeFilters ( filters)

添加要排除的测试的过滤器的ERROR(/Set)

参数
filters

添加所有包含过滤器

public void addAllIncludeFilters ( filters)

添加要包含的测试的过滤器的ERROR(/Set)

参数
filters

添加类名

public void addClassName (String className)

添加要运行的测试类名称。

参数
className String

添加类名

public void addClassNames ( classNames)

添加要运行的测试类名称集合。

参数
classNames

添加排除过滤器

public void addExcludeFilter (String filter)

添加要排除的测试的过滤器。

参数
filter String

添加包含过滤器

public void addIncludeFilter (String filter)

添加要包含的测试的过滤器。

参数
filter String

添加运行参数

public void addRunArg (String key, 
                String value)

添加运行 UI Automator 测试时提供的参数

参数
key String : 参数名称

value String : 参数值

清除排除过滤器

public void clearExcludeFilters ()

删除当前跟踪的所有排除过滤器。

清除包含过滤器

public void clearIncludeFilters ()

删除当前跟踪的所有包含过滤器。

获取类名

public  getClassNames ()

获取配置运行的测试类名称列表

退货
测试类名称列表

获取设备

public ITestDevice getDevice ()

获取被测设备。

退货
ITestDevice ITestDevice

获取排除过滤器

public  getExcludeFilters ()

返回排除过滤器的当前ERROR(/Set)

退货

获取包含过滤器

public  getIncludeFilters ()

返回包含过滤器的当前ERROR(/Set)

退货

获取同步时间

public long getSyncTime ()

退货
long分配给测试同步的时间。

获取TestJarPaths

public  getTestJarPaths ()

退货
测试 jar 路径。

获取测试运行参数映射

public  getTestRunArgMap ()

退货
参数映射以传递给 UiAutomatorRunner。

获取测试运行器

public IRemoteAndroidTestRunner getTestRunner ()

退货
IRemoteAndroidTestRunner测试运行者。

是仪器测试

public boolean isInstrumentationTest ()

退货
boolean

跑步

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

运行测试,并将结果报告给侦听器。

参数
testInfo TestInformationTestInformation对象包含运行测试的有用信息。

listener ITestInvocationListener :测试结果的ITestInvocationListener

投掷
DeviceNotAvailableException

设置捕获日志

public void setCaptureLogs (boolean captureLogs)

此方法已被弃用。
使用setLoggingOption(com.android.tradefed.testtype.UiAutomatorTest.LoggingOption)代替。

保留是为了与 cts-tradefed 兼容

参数
captureLogs boolean

设置设备

public void setDevice (ITestDevice device)

注入被测设备。

参数
device ITestDevice :要使用的ITestDevice

设置日志选项

public void setLoggingOption (UiAutomatorTest.LoggingOption loggingOption)

参数
loggingOption UiAutomatorTest.LoggingOption

设置运行名称

public void setRunName (String runName)

参数
runName String

设置跑步者名称

public void setRunnerName (String runnerName)

参数
runnerName String

设置同步时间

public void setSyncTime (long syncTime)

参数
syncTime long :测试文件同步的时间。

设置TestJarPaths

public void setTestJarPaths ( jarPaths)

参数
jarPaths :测试罐的位置。

setTestRunArgMap

public void setTestRunArgMap ( runArgMap)

参数
runArgMap :传递给 UiAutomatorRunner 的参数。

受保护的方法

创建测试运行器

protected IRemoteAndroidTestRunner createTestRunner ()

退货
IRemoteAndroidTestRunner

投掷
DeviceNotAvailableException

获取运行工具

protected IRunUtil getRunUtil ()

退货
IRunUtil

屏幕截图和错误报告

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

参数
device ITestDevice

listener ITestInvocationListener

prefix String

overrideAction UiAutomatorTest.TestFailureAction

屏幕截图和错误报告

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

参数
device ITestDevice

listener ITestInvocationListener

prefix String

预测试设置

protected void preTestSetup ()

检查设备上是否存在 UI Automator 组件

投掷
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException