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 元件 |
領域
mListeners
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 | 分配給測試同步的時間。 |
取得TestJarPaths
publicgetTestJarPaths ()
退貨 | |
---|---|
測試 jar 路徑。 |
取得測試運行參數映射
publicgetTestRunArgMap ()
退貨 | |
---|---|
參數映射以傳遞給 UiAutomatorRunner。 |
取得測試運行器
public IRemoteAndroidTestRunner getTestRunner ()
退貨 | |
---|---|
IRemoteAndroidTestRunner | 測試運行者。 |
是儀器測試
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 |
設定跑步者名稱
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 |
受保護的方法
建立測試運行器
protected IRemoteAndroidTestRunner createTestRunner ()
退貨 | |
---|---|
IRemoteAndroidTestRunner |
投擲 | |
---|---|
DeviceNotAvailableException |
螢幕截圖和錯誤報告
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 |