如何在xcode4中实现应用程序测试? [英] how to implement application tests in xcode4?

查看:105
本文介绍了如何在xcode4中实现应用程序测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的应用添加一些测试。在Apple的Document之后,我在我的项目中添加了两个测试包。
逻辑测试没有问题,但是当我尝试在设备上进行应用程序测试时,我总是得到逻辑测试不能在设备上运行的错误。

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...

有任何建议吗?

谢谢,Tim

推荐答案

我也遇到了在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"


  1. 向项目添加other / Cocoa Unit Testing Bundle类型的新目标,例如MyAppTesting。这里列出了所有单元测试文件。

  2. 转到MyAppTesting Build Phases并添加MyApp作为Target Dependency。这可以确保在构建MyAppTesting目标之前构建MyApp。

  3. 打开MyAppTesting的构建设置并更改
    • Bundle Loader:$(BUILT_PRODUCTS_DIR)/ MyApp .app / MyApp

    • 测试主机:$(BUNDLE_LOADER)

  1. Add a new target of type "other/Cocoa Unit Testing Bundle" to the project e.g "MyAppTesting". Here all Unit test files are located.
  2. Go to MyAppTesting Build Phases and add MyApp as Target Dependency. This assures that MyApp is build before building the MyAppTesting target.
  3. Open the Build Settings of MyAppTesting and change
    • Bundle Loader: $(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp
    • Test host: $(BUNDLE_LOADER)
  • 默认情况下隐藏的符号:NO(两者都是)

  • 复制期间剥离调试符号:调试:否

要在设备插件上运行测试,请选择设备上的MyAppTesting方案并运行为测试。确保所提到的方案在Test / Build Configuration中设置了Debug,这应该是默认的。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆