問題描述
通常,我發(fā)現(xiàn)幾乎所有我最重要的 iPhone 開發(fā)測試用例都圍繞 UI 測試,而不是業(yè)務(wù)邏輯或數(shù)據(jù)測試.我對 XCode 環(huán)境中的自動化 UI 測試不是很熟悉.有人能指點(diǎn)我一個好的教程或書籍嗎?
Typically I find that nearly all my most important test cases for iPhone development revolve around UI testing rather than business logic or data testing. I'm not very familiar with automated UI testing in the XCode environment. Can someone point me to a good tutorial or book?
更新
這個問題是幾年前寫的,從那時起 UI 測試已經(jīng)走了很長一段路.使用 UI 自動化仍然是一種選擇,但 KIF 框架 是功能測試更好的解決方案現(xiàn)在,海事組織.
UPDATE
This question was written several years ago and UI testing has come a long way since then. Using the UI Automation is still an option, but the KIF Framework is a much better solution for functional testing now, IMO.
來自 KIF 的 github 頁面:
From KIF's github page:
KIF,代表 Keep It Functional,是一個 iOS 集成測試框架.它通過利用操作系統(tǒng)為具有以下功能的人提供的可訪問性屬性視力障礙.
KIF, which stands for Keep It Functional, is an iOS integration test framework. It allows for easy automation of iOS apps by leveraging the accessibility attributes that the OS makes available for those with visual disabilities.
KIF 使用標(biāo)準(zhǔn) XCTest 測試構(gòu)建和執(zhí)行測試目標(biāo).測試在主線程中同步進(jìn)行(運(yùn)行運(yùn)行循環(huán)強(qiáng)制時間流逝)允許更復(fù)雜邏輯和組成.這也使 KIF 能夠利用Xcode 5 Test Navigator、命令行構(gòu)建工具和 Bot 測試報(bào)告.
KIF builds and performs the tests using a standard XCTest testing target. Testing is conducted synchronously in the main thread (running the run loop to force the passage of time) allowing for more complex logic and composition. This also allows KIF to take advantage of the Xcode 5 Test Navigator, command line build tools, and Bot test reports.
推薦答案
您最好的選擇是使用隨 iOS 4.0 首次亮相的 UI 自動化工具.可以編寫腳本來測試用戶界面的許多方面.
Your best bet will be to use the UI Automation instrument that debuted with iOS 4.0. This can be scripted to test out many aspects of your user interface.
Apple 在 WWDC 2010 會議 306 - "Automating使用儀器進(jìn)行用戶界面測試".我在我的高級 iOS 開發(fā)課程 在 iTunes U 上.可以在此處.
Apple provides a great introduction to this tool in the video for the WWDC 2010 session 306 - "Automating User Interface Testing with Instruments". I demonstrate how to set up scripts and do testing in the video for the "Testing" session of my advanced iOS development course on iTunes U. My notes on UI Automation from that class, including sample scripts, can be found here.
此外,您可能還想看看 James Turner 的文章如何使用 UIAutomation 來創(chuàng)建 iPhone UI 測試" 和 Alex Vollmer 的 "使用 UIAutomation".
Additionally, you might want to look at James Turner's article "How to use UIAutomation to create iPhone UI tests" and Alex Vollmer's "Working with UIAutomation".
這篇關(guān)于可可觸控自動化UI測試有沒有好的教程?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!