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

傳回目前的 include 篩選器 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)

This method is deprecated.
請改用 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