首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Xcode 4: iOS模拟器中的应用测试

Xcode 4: iOS模拟器中的应用测试
EN

Stack Overflow用户
提问于 2011-11-05 01:26:31
回答 1查看 2.5K关注 0票数 3

我对Xcode4 4在iOS模拟器中运行应用程序测试的能力感到困惑。

一方面,苹果自己的文档显示,应用程序测试可以在模拟器中运行。另一方面,我在这里读过论坛,似乎大多数人都发现,应用程序测试只能在设备上运行。

如果后者是正确的,请包括一个链接,以证明这一点。我什么都没找到。

无论如何,来自iOS应用程序开发工作流指南:单元测试应用程序

Listing 6-2 Transcript of an iOS Simulator-based application unit-test run

而且还

Note: Although Xcode can run logic and application unit tests in simulators, Xcode cannot run logic unit tests on devices. Therefore, if you include and have active both types of unit tests in a scheme, you will not be able to use that scheme to run unit tests on devices.

问题是模拟器不提供对UIApplicationDelegate的访问。下面是一个示例测试来演示:

- (void) testAppDelegate { id yourApplicationDelegate = [[UIApplication sharedApplication] delegate]; STAssertNotNil(yourApplicationDelegate, @"UIApplication failed to find the AppDelegate"); }

这个测试在我的项目中失败了。顺便说一句,我的逻辑测试运行良好。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-11-06 20:49:58

我的错,我说得太早了。我试过这个解决方案,它很管用。换句话说,我现在能够在iOS模拟器中运行逻辑测试和应用测试。

确保在测试目标的生成设置中同时设置bundle loadertest host参数。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8017505

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档