ios – 有可可触摸自动UI测试的好教程吗?

通常我发现几乎所有我最重要的iPhone开发测试用例都围绕UI测试而不是业务逻辑或数据测试.我不太熟悉XCode环境中的自动化UI测试.有人可以指点一个好的教程或书吗?

UPDATE
这个问题是几年前写的,UI测试从那以后已经走了很长的路.使用UI自动化仍然是一个选择,但KIF Framework是现在功能测试的更好的解决方案,IMO.

从KIF的github页面

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 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自动化仪器.这可以脚本来测试用户界面的许多方面.

苹果在WWDC 2010会议306的视频(“用仪器自动用户界面测试”)中为该工具提供了一个很好的介绍.我演示了如何在视频中设置脚本并在我的高级iOS开发课程on iTunes U的“测试”会话中进行测试.我可以在here中找到我从该课程中介绍的UI Automation的注释,包括示例脚本.

此外,您可能需要查看James Turner的文章How to use UIAutomation to create iPhone UI tests”和Alex Vollmer的“Working with UIAutomation”.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...