Xcode 5:单元测试未运行 [英] Xcode 5: Unit Tests not running

查看:85
本文介绍了Xcode 5:单元测试未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一些测试用例并且它们都通过了...那是因为它们没有被运行。

I created a few test cases and they all passed... That's because they are not being run.

从Xcode,我得到:

From Xcode, I get:

Test Suite 'All tests' started at...
Test Suite 'All tests' finished at...
Executed 0 tests, with 0 failures (0 unexpected) in 0.00 seconds

项目(和单元测试类)构建成功。

The project (and unit test classes) build successfully.

我的所有测试类都选择了MyApp_appTests作为目标成员资格。生产类有MyApp_app&已选择MyApp_appTests目标。

All my test classes have MyApp_appTests as Target Membership selected. Production classes have MyApp_app & MyApp_appTests targets selected.

我验证了MyApp_appTests目标构建设置(捆绑加载器和测试主机)。

I verified the MyApp_appTests Target Build Settings (Bundle Loader & Test Host).

Bundle Loader (Debug): $(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp
Test Host (Debug): $(BUNDLE_LOADER)

我已导入SenTestingKit.framework(通过Targets Build PhasesLink Binary with Libraries)。

I have imported SenTestingKit.framework (through Targets Build Phases "Link Binary With Libraries").

我的所有测试都以开头 - (void)testThat ...

我还检查了一些stackoverflow .com问题:

I have also checked a few stackoverflow.com questions:

stackoverflow.com/questions/8632254/xcode-4-2-cant-run-unit-test
stackoverflow.com/questions/3608484/ocunit-tests-not-running-not-being-found
stackoverflo w.com/questions/16672616/ocunit-test-cases-not-running

和这篇文章:

twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/

我不喜欢知道在哪里寻找...非常感谢任何帮助!

I don't know where to look for... Any help is greatly appreciated!

推荐答案

Xcode 5现在使用的是XCTestCase,而不是SenTest。 Apple现在更直接地支持单元测试,包括他们自己的名为XCTestCase的SenTest版本。此外,UI得到了很大改进,允许运行单个测试,测试导航器,不再创建.h测试文件。请注意,测试宏不是使用XC前缀重命名。

Xcode 5 now used XCTestCase, not SenTest. Apple is now supporting Unit Testing more directly including their own version of SenTest named XCTestCase. Additionally the UI is much improved, allowing individual tests to be run, a Test Navigator and no longer creating .h test files. Note that the test macros are not renames with an XC prefix.

请参阅WWDC-13视频409:在Xcode 5中测试。

See the WWDC-13 video 409: "Testing in Xcode 5".

如果您使用Xcode 5模板创建测试环境,项目将包括测试目标和工作(和失败)测试。

If you use the Xcode 5 template to create the testing environment the project will include a test target and a working (and failing) test.

这篇关于Xcode 5:单元测试未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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