問題描述
我最近開始研究在 Android 上自動進行無障礙測試.網上沒有太多信息.有沒有人探索過這個或目前正在這樣做?如果是這樣,你能分享你的想法/方法嗎?
I recently started looking into automating accessibility testing on Android. There isn't much information out there on the web. Has anyone explored this or are currently doing this? If so, can you share your ideas/approach?
似乎 Android 的 uiautomator 依賴于輔助功能的工作,但它不支持測試輔助功能.如果它依賴于 Accessibility 特性,那是否意味著是否存在可訪問標簽等基本驗證可以通過使用 uiautomator 執行 UI 測試來完成?
Seems like Android's uiautomator relies on Accessibility features working but it doesn't support testing Accessibility. If it relies on Accessibility features, does that mean that basic validation like accessible label exists, etc. can be done by just executing UI tests using uiautomator?
這對我來說是一個新領域,所以任何信息都會有所幫助.
This is a new area for me so any information could be helpful.
推薦答案
這里有一個 偉大的介紹 Android 中的輔助功能測試.基本上可以歸結為:
Here's a great introduction to Accessibility testing in Android. It basically boils down to:
- 使用 輔助功能掃描器
- 開啟 TalkBack 并手動測試您的應用以發現聽力受損問題
- 要查找字體縮放和布局問題,請使用 Large Text李>
- 絕對 lint 檢查,但請確保沒有 contentDescription 的圖像"設置為 Severity = Error
- 如果您發現或再次出現任何/所有可訪問性問題,請編寫 Espresso 測試以在將來違反該可訪問性問題時失敗
- 對于自動化,如果需要聽力受損的功能,您還需要考慮如何對某些屏幕偽影和音頻分析執行視覺驗證.
另外,我建議觀看 此來自 GTAC 2015 的演示,了解某些人的可訪問性測試很好的主題背景.
Also, I recommend watching this presentation from GTAC 2015 on accessibility testing for some great context on the topic.
對于檢查可訪問性的自動化測試,我非常建議從可以在跨屏幕共享的元素(菜單、布局、主題、自定義控件)中識別的問題開始.雖然它們不會捕捉到偶爾會彈出的一次性錯誤,但它們會解決您應用中隨處發生的問題,如果您愿意的話,這是一種按數量劃分優先級"的方法.
For automated tests that check for accessibility, I'd very much recommend starting with issues that can be identified in elements that are shared across screens (menus, layouts, themes, custom controls). While they won't catch the one-off errors that will occasionally pop up, they'll address issues that happen everywhere in your app, a 'prioritize by volume' approach if you will.
此外,如果您的團隊使用 Android Studio,那么您肯定希望能夠編寫駐留在代碼中的 Espresso 測試.QA 是開發過程的一部分.除非有一些合法的博洛尼亞要處理,否則訪問您的測試所在的子文件夾應該不是問題.例如,將 'androidTest' 文件夾拆分為 子模塊 作為測試人員,您擁有拉/推權限,但只能讀取應用程序其余部分的權限,因此您可以自己編譯和運行.如果您正在編寫 Appium 測試,可能更難要求您的開發團隊在構建期間將它們作為自己的 BVT/smoke 測試過程的一部分運行,但并非聞所未聞.
Also, if your team uses Android Studio then you definitely want to push for the ability to write Espresso tests that reside with the code. QA are part of the development process, period. Getting access to a subfolder where your tests reside shouldn't be a problem unless there some legal bologna to deal with. For instance, split out the 'androidTest' folder as a submodule where you have pull/push rights as a tester, but only read rights to the rest of the app so you can compile and run yourself. If you're writing Appium tests, it may be harder to ask your dev team to run them as part of their own BVT/smoke test process during builds, but not unheard of.
至于視覺分析和音頻注入/確認,這些是您可能需要使用某些服務或商業工具的高級功能為.
As for visual analysis and audio injection/confirmation, these are advanced capabilities that you'll probably need to use some service or commercial tool for.
祝你好運!
這篇關于Android 上的可訪問性測試自動化的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!