轉載地址:http://qa.blog.163.com/blog/static/1901470022015128112621838/
Android自動化測試工具Robotium當前已更新至5.3.1版本,以下整理了Robotium 5.X系列的更新日誌,方便各位使用Robotium的童鞋瞭解Robotium的最新進展。
Google:https://code.google.com/p/robotium/
Github:https://github.com/RobotiumTech/robotium
Google:https://code.google.com/p/robotium/
Github:https://github.com/RobotiumTech/robotium
Robotium 5.3.1
我們一直專注於對Robotium各個方面的完善。比如,已經完成了對點擊操作邏輯以及速率上的改善。該版本在修復Bug的同時,也加入了一些新特性,比如setWiFiData。
新特性:
- setWiFiData - 設置WIFI的開關
- setMoibleData - 設置手機數據的開關
- getView(Object tag) - 通過特定的標記獲取View對象
- getView(Object tag, int index) - 通過特定的標記以及索引獲取View對象
- waitForView(Object tag) - 等待特定標記的View對象出現
- waitForView(Object tag, int minimumNumberOfMatches, int timeout, boolean scroll) - 等待特定標記的View對象出現。可設置最小的匹配數以及是否滑屏操作
- 修復scroll方法不支持RecyclerViews的問題
- Solo.Config可配置trackActivities參數爲false,用以關閉Activity的處理
Robotium 5.2.1
我們一直專注於優化滑動方法,包括對這些方法的提速以及邏輯上的完善。該版本在修復Bug的同時,也加入了一些新特性,比如unlockScreen。
新特性:
- unlockScreen() - 屏幕解鎖
- getCurrentViews(Class classToFilterBy, boolean includeSubclasses) - 新增參數includeSubclasses,如果設置爲true,則會返回子類
- scrollToSide(Side side, float scrollPosition, int stepCount) - stepCount參數控制滑動的速度
- scrollViewToSide(View view, Side side, float scrollPosition, int stepCount) - stepCount參數控制滑動的速度
Robotium 5.1
對Robotium的優化仍在進行中,不過5.1版本是到目前爲止最快最準確且最穩定的版本了
注意:現在的包名是: com.robotium.solo
新特性:
- Solo(Instrumentation instrumentation, Config config, Activity activity) - 新構造器
- pressSoftKeyboardSearchButton() - 點擊軟鍵盤上的搜索按鈕
- getWebElements() - 返回激活狀態的WebView下的所有WebElements元素
- getWebElements(By by) - 返回激活狀態的WebView下匹配By對象的所有WebElements元素
- setNavigationDrawer(int status) - 設置NavigationDrawer的狀態.
- getConfig() - 獲取Robotium的配置
Robotium 5.0.1
當前版本引入了SoloConfig類,Robotium的開發者們可以在該類中修改配置,比如默認的超時時間,截圖路徑以及各式,滑動還有web element的點擊行爲。同樣地,本次更新對一些內部類做了優化。
注意:現在的包名是: com.robotium.solo
新特性:
- pressSoftKeyboardNextButton()
- waitForEmptyActivityStack()
Solo.Config:
- int timeout_large - waitFor方法的超時時長.
- int timeout_small - get, is, set, assert, enter and click方法的超時時長.
- String screenshotSavePath - 截圖保存路徑
- ScreenshotFileType screenshotFileType - 截圖文件格式,比如JPEG或者PNG.
- boolean shouldScroll - 設置爲true,如果get, is, set, enter, type and click方法需要滾屏
- boolean useJavaScriptToClickWebElements - 設置爲true,如果使用JavaScript 來點擊WebElements.
優化:
- 優化所有的點擊方法在不適合的場景下的行爲
- waitForDialogToOpen以及waitForDialogToClose
- 內部View的處理
- 當前的TakeScreenshot方法支持GLSurfaceViews