如何在 xcode4 中实现应用程序测试? [英] how to implement application tests in xcode4?
问题描述
我正在尝试为我的应用程序添加一些测试.遵循 Apple 的文档,我将两个测试包添加到我的项目中.逻辑测试没有问题,但是当我尝试在设备上进行应用程序测试时,我总是收到逻辑测试无法在设备上运行的错误.
I'm trying to add some Tests for my application. Following the Document from Apple, I add two testing bundles to my project. The logic tests are no problem, but when I try to make the application tests on a device I always get the error that the logic tests don't run on a device.
在 Xcode 3 中没有问题.只有 Xcode 4 会抛出这个错误...
In Xcode 3 there is no problem with that. Only Xcode 4 throws this error...
有什么建议吗?
谢谢,蒂姆
推荐答案
我在 xcode4 中设置应用程序测试时也遇到了问题.对我有用的解决方案如下:
i was also having problems with setting up application tests in xcode4. A solution that worked for me was as follows:
假设您有一个名为MyApp"的应用程序目标
Assuming you have an application target called "MyApp"
- 向项目添加类型为other/Cocoa Unit Testing Bundle"的新目标,例如MyAppTesting".所有单元测试文件都位于此处.
- 转到 MyAppTesting 构建阶段并将 MyApp 添加为目标依赖项.这可确保在构建 MyAppTesting 目标之前构建 MyApp.
- 打开 MyAppTesting 的 Build Settings 并更改
- 捆绑加载器:$(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp
- 测试主机:$(BUNDLE_LOADER)
- 默认隐藏符号:NO(对于两者)
- 复制期间去除调试符号:Debug:NO
要在设备上运行测试,请插入设备并选择MyAppTesting on device"方案并作为测试运行.确保提到的方案在测试/构建配置中设置了调试",这应该是默认的.
To run the test on a device plugin the device and select the scheme "MyAppTesting on device" and run as test. Assure that the mentioned scheme has set "Debug" within Test/Build Configuration which should be default.
最好的问候.
这篇关于如何在 xcode4 中实现应用程序测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!