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 组件

字段

mListener

protected  mListeners

公共构造函数

UiAutomatorTest

public UiAutomatorTest ()

公共方法

添加全部排除过滤器

public void addAllExcludeFilters ( filters)

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

参数
filters

添加全部包含过滤器

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