XCode 4中的单元测试 [英] Unit testing in XCode 4

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

问题描述

我已经设法在Xcode 4中为我的库设置了单元测试。我已经使用我知道将通过和失败的测试执行构建(即 STAssertTrue(YES) STAssertTrue(NO))只是为了确保它正常工作。我在这个文件

I've managed to set up unit tests for my library in Xcode 4. I've performed builds with tests that I know will pass and fail (i.e. STAssertTrue(YES) and STAssertTrue(NO) ) just to make sure it's working. I'm using the default apple SenTest libraries following this document.

然而,当我的测试运行时,我得到了这个构建日志中的错误:

However, when my tests are running I'm getting this error in the build log :


处理命令输出时发生内部错误: - [IDEActivityLogSectionRecorder endMarker]:无法识别的选择器发送到实例0x20310b580

An internal error occurred when handling command output: -[IDEActivityLogSectionRecorder endMarker]: unrecognized selector sent to instance 0x20310b580

要清楚,它根本不会影响测试的运行,只会影响构建窗口的输出。每次都运行所有测试,所以我可以通过查看构建是成功还是失败来判断通过/失败。

To be clear, it's not affecting the running of the tests at all, just the output into the build window. All the tests run each time so I can tell a pass / fail by looking to see if the build succeeds or fails.

然而,当我的测试失败时,我不能找出哪一个失败,因为当出现错误时输出似乎停止。

However, when my tests fail I can't find out which one fails because the output seems to stop when it gets to that error.

有没有人有单位测试经验/ Xcode 4 /这个错误?

Does anyone have experience with unit testing / Xcode 4 / this error?

推荐答案

我意识到它并没有直接回答你的问题,但忘了SenTestingKit并使用GHUnit。你需要大约10分钟才能弄明白(比OCUnit简单得多)并且会给你带来很多麻烦。恕我直言,Apple应该使用Xcode代替OCUnit。

I realise it doesn't directly answer your question, but forget SenTestingKit and use GHUnit. It'll take you about 10 minutes to figure out (much more straightforward than OCUnit) and will save you a lot of headaches. IMHO, Apple should be shipping it with Xcode instead of OCUnit.

GHUnit可以在真正的应用程序环境(使用GUI)或命令行上运行测试。它实际上只是作为一个单独的目标进入你现有的项目。

GHUnit can run your tests in a true application environment (with a GUI), or on the command line. It literally just drops into your existing project as a separate target.

https://github.com/gabriel/gh-unit

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

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