如何使用 Xcode 4 和 OCUnit 运行应用程序测试?
我正在使用 OCUnit 编写单元测试,我尝试了 GHUnit 但它不适合我的情况。
我确实想运行应用程序测试,因为我的代码严重依赖于我的 ApplicationDelegate 实例。但我只能弄清楚如何运行逻辑测试而不是应用程序测试。
这是来自模板的示例测试代码,但我的测试失败(无应用程序委托)或根本没有测试代码运行。
- (void) testAppDelegate {
id yourApplicationDelegate = [[UIApplication sharedApplication] delegate];
STAssertNotNil(yourApplicationDelegate, @"UIApplication failed to find the AppDelegate");
}
我找到了指南来自苹果关于如何设置测试的信息,但不适用于 Xcode 4
I am using OCUnit to write unit test, i tried GHUnit but it does not suit my case.
I do want to run a application test because my code heavily relied on my ApplicationDelegate instance. But i can only figure out how to run logic test but not application test.
This is a sample testing code from template, but either my test failed (no application delegate) or no testing code run at all.
- (void) testAppDelegate {
id yourApplicationDelegate = [[UIApplication sharedApplication] delegate];
STAssertNotNil(yourApplicationDelegate, @"UIApplication failed to find the AppDelegate");
}
I found a guide from apple about how to set up the test, but it is not for Xcode 4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这里找到答案
如何在 xcode4 中实现应用程序测试?
found answer here
how to implement application tests in xcode4?