UiAutomatorTest

public class UiAutomatorTest
extends Object implements IDeviceTest, IRemoteTest, ITestFilterReceiver

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


摘要

字段

protected mListeners

公共构造函数

UiAutomatorTest()

公共方法

void addAllExcludeFilters( filters)

添加了要排除的测试的过滤条件的 ERROR(/Set)

void addAllIncludeFilters( filters)

添加了要包含的测试的过滤条件 ERROR(/Set)

void addClassName(String className)

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

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

公共构造函数

UiAutomatorTest

public UiAutomatorTest ()

公共方法

addAllExcludeFilters

public void addAllExcludeFilters ( filters)

添加了要排除的测试的过滤条件的 ERROR(/Set)

参数
filters

addAllIncludeFilters

public void addAllIncludeFilters ( filters)

添加了要包含的测试的过滤条件 ERROR(/Set)

参数
filters

addClassName

public void addClassName (String className)

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

参数
className String

addClassNames

public void addClassNames ( classNames)

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

参数
classNames

addExcludeFilter

public void addExcludeFilter (String filter)

添加了要排除的测试的过滤条件。

参数
filter String

addIncludeFilter

public void addIncludeFilter (String filter)

添加了用于指定要包含哪些测试的过滤条件。

参数
filter String

addRunArg

public void addRunArg (String key, 
                String value)

添加了在运行 UI Automator 测试时提供的实参

参数
key String:实参名称

value String:实参值

clearExcludeFilters

public void clearExcludeFilters ()

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

clearIncludeFilters

public void clearIncludeFilters ()

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

getClassNames

public  getClassNames ()

获取了桩架配置为运行的测试类名称列表

返回
测试类名称列表

getDevice

public ITestDevice getDevice ()

获取被测设备。

返回
ITestDevice ITestDevice

getExcludeFilters

public  getExcludeFilters ()

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

返回

getIncludeFilters

public  getIncludeFilters ()

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

返回

getSyncTime

public long getSyncTime ()

返回
long 为测试同步分配的时间。

getTestJarPaths

public  getTestJarPaths ()

返回
测试 jar 路径。

getTestRunArgMap

public  getTestRunArgMap ()

返回
要传递给 UiAutomatorRunner 的实参映射。

getTestRunner

public IRemoteAndroidTestRunner getTestRunner ()

返回
IRemoteAndroidTestRunner 测试运行程序。

isInstrumentationTest

public boolean isInstrumentationTest ()

返回
boolean

得分

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

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

参数
testInfo TestInformation:包含用于运行测试的实用信息的 TestInformation 对象。

listener ITestInvocationListener:测试结果的 ITestInvocationListener

抛出
DeviceNotAvailableException

setCaptureLogs

public void setCaptureLogs (boolean captureLogs)

此方法已弃用。
请改用 setLoggingOption(com.android.tradefed.testtype.UiAutomatorTest.LoggingOption)

保留以实现与 cts-tradefed 的兼容性

参数
captureLogs boolean

setDevice

public void setDevice (ITestDevice device)

注入被测设备。

参数
device ITestDevice:要使用的 ITestDevice

setLoggingOption

public void setLoggingOption (UiAutomatorTest.LoggingOption loggingOption)

参数
loggingOption UiAutomatorTest.LoggingOption

setRunName

public void setRunName (String runName)

参数
runName String

setRunnerName

public void setRunnerName (String runnerName)

参数
runnerName String

setSyncTime

public void setSyncTime (long syncTime)

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

setTestJarPaths

public void setTestJarPaths ( jarPaths)

参数
jarPaths :测试 JAR 的位置。

setTestRunArgMap

public void setTestRunArgMap ( runArgMap)

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

受保护的方法

createTestRunner

protected IRemoteAndroidTestRunner createTestRunner ()

返回
IRemoteAndroidTestRunner

抛出
DeviceNotAvailableException

getRunUtil

protected IRunUtil getRunUtil ()

返回
IRunUtil

onScreenshotAndBugreport

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

参数
device ITestDevice

listener ITestInvocationListener

prefix String

overrideAction UiAutomatorTest.TestFailureAction

onScreenshotAndBugreport

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

参数
device ITestDevice

listener ITestInvocationListener

prefix String

preTestSetup

protected void preTestSetup ()

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

抛出
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException