OCUnit 是否允许在 iPhone 模拟器上运行应用程序测试?
苹果公司的《iPhone开发指南》第62页建议“因为应用程序测试只在设备上运行,所以你也可以使用这些测试来执行硬件测试......”。
我也想在模拟器中运行我的 OCUnit 测试用例 - 但还没有弄清楚如何做到这一点。是否可以?或者我必须使用 Google 的工具包吗? http://code.google.com/p/google-toolbox-for -mac/
Apple's "iPhone Development Guide" suggests on page 62 that "Because application tests run only on a device, you can also use these tests to perform hardware testing...".
I'd like to run my OCUnit test cases in the simulator as well -- but haven't figured out how to do that. Is it possible? Or do I have to use Google's toolkit instead? http://code.google.com/p/google-toolbox-for-mac/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
花了一天时间进行挖掘,但 OCUnit 似乎不允许在模拟器上进行测试,而只能在设备上进行测试。 Google Toolkit for Mac 更适合在模拟器上进行测试:http ://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting
Took a day of digging around, but it appears that OCUnit does not allow tests on the simulator but on device only. Google Toolkit for Mac is better suited for testing on the simulator: http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting
将 UnitTestBundle 添加到应用程序后,打开其 Info(getinfo) 并在其他链接器标志中将 Cocoa 更改为 Foundation,更改后其他链接器标志应该像这样
-framework
基础
-框架
SenTestingKit
HTH
Once you add UnitTestBundle to your application open its Info(getinfo) and in other linker flags change Cocoa to Foundation, after your change other linker flags should like this
-framework
Foundation
-framework
SenTestingKit
HTH
XCode 4.1 将允许您使用“测试”方案在模拟器中运行逻辑测试,但应用程序测试将失败,因为无法获取 UIApplicationDelegate 的实例。
XCode 4.1 不允许您在设备上运行逻辑测试。它会向您显示以下错误:
逻辑测试不可用
不支持 iOS 设备上的逻辑测试。您可以在模拟器上运行逻辑测试。
XCode 4.1 will let you run logic tests in the simulator using the "Test" scheme, but application tests will fail because won't be able to get an instance of your UIApplicationDelegate.
XCode 4.1 won't allow you to run logic tests on device. It gives you the following error:
Logic Testing Unavailable
Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator.
从 XCode 4 和 iOS 4 开始,应用程序测试可以在设备和模拟器上运行。
As of XCode 4 and iOS 4, application tests can run on both device and simulator.