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) 添加要排除的測試的過濾器的 |
void | addAllIncludeFilters ( filters) addAllIncludeFilters ( filters) 添加要包含哪些測試的過濾器的 |
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 () 返回排除過濾器的當前 | |
getIncludeFilters () 返回包含過濾器的當前 | |
long | getSyncTime () |
getTestJarPaths () | |
getTestRunArgMap () | |
IRemoteAndroidTestRunner | getTestRunner () |
boolean | isInstrumentationTest () |
void | run ( TestInformation testInfo, ITestInvocationListener listener) 運行測試,並將結果報告給偵聽器。 |
void | setCaptureLogs (boolean captureLogs) 此方法已棄用。請改用 |
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 組件 |
領域
聽眾
protectedmListeners
公共構造函數
UiAutomator測試
public UiAutomatorTest ()
公共方法
添加類名
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 ()
刪除當前跟踪的所有包含過濾器。
獲取類名
publicgetClassNames ()
獲取線束配置為運行的測試類名稱列表
退貨 | |
---|---|
測試類名稱列表 |
獲取同步時間
public long getSyncTime ()
退貨 | |
---|---|
long | 分配給測試同步的時間。 |
getTestJarPaths
publicgetTestJarPaths ()
退貨 | |
---|---|
測試罐路徑。 |
getTestRunArgMap
publicgetTestRunArgMap ()
退貨 | |
---|---|
參數映射以傳遞給 UiAutomatorRunner。 |
獲取測試運行程序
public IRemoteAndroidTestRunner getTestRunner ()
退貨 | |
---|---|
IRemoteAndroidTestRunner | 測試跑步者。 |
isInstrumentationTest
public boolean isInstrumentationTest ()
退貨 | |
---|---|
boolean |
跑步
public void run (TestInformation testInfo, ITestInvocationListener listener)
運行測試,並將結果報告給偵聽器。
參數 | |
---|---|
testInfo | TestInformation :包含運行測試的有用信息的TestInformation 對象。 |
listener | ITestInvocationListener : 測試結果的ITestInvocationListener |
投擲 | |
---|---|
DeviceNotAvailableException |
設置捕獲日誌
public void setCaptureLogs (boolean captureLogs)
此方法已棄用。
請改用setLoggingOption(com.android.tradefed.testtype.UiAutomatorTest.LoggingOption)
。
參數 | |
---|---|
captureLogs | boolean |
設置日誌記錄選項
public void setLoggingOption (UiAutomatorTest.LoggingOption loggingOption)
參數 | |
---|---|
loggingOption | UiAutomatorTest.LoggingOption |
設置運行名稱
public void setRunName (String runName)
參數 | |
---|---|
runName | String |
設置RunnerName
public void setRunnerName (String runnerName)
參數 | |
---|---|
runnerName | String |
設置同步時間
public void setSyncTime (long syncTime)
參數 | |
---|---|
syncTime | long :測試文件同步的時間。 |
setTestJarPaths
public void setTestJarPaths (jarPaths)
參數 | |
---|---|
jarPaths |
setTestRunArgMap
public void setTestRunArgMap (runArgMap)
參數 | |
---|---|
runArgMap |
受保護的方法
創建測試運行程序
protected IRemoteAndroidTestRunner createTestRunner ()
退貨 | |
---|---|
IRemoteAndroidTestRunner |
投擲 | |
---|---|
DeviceNotAvailableException |
onScreenshotAnd錯誤報告
protected void onScreenshotAndBugreport (ITestDevice device, ITestInvocationListener listener, String prefix, UiAutomatorTest.TestFailureAction overrideAction)
參數 | |
---|---|
device | ITestDevice |
listener | ITestInvocationListener |
prefix | String |
overrideAction | UiAutomatorTest.TestFailureAction |
onScreenshotAnd錯誤報告
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 |