Xcode 4.4单元测试没有完成

时间:2012-08-02 09:13:05

标签: unit-testing warnings xcode4.4

  

可能重复:
  Some of my unit tests tests are not finishing in XCode 4.4

我刚刚升级到XCode 4.4。我创建了一个新项目,包括单元测试。运行测试时,我收到警告“所有测试都没有完成”。

干净安装xcode 4.4的同事有完全相同的问题。他们没有输入单个代码,只创建了一个包含单元测试的新项目。

我们做错了什么以及如何解决问题?

enter image description here

4 个答案:

答案 0 :(得分:1)

见过这个。它是由代码中的错误(“无法识别的选择器发送到实例”)引起的,这导致测试挂起。

答案 1 :(得分:0)

我遇到了同样的问题。我注意到我的原始测试类(MyAppTests),由Xcode插入,没有测试。所以在测试输出中我有

Test Suite 'MyAppTests' started at 2012-08-18 14:30:27 +0000
Test Suite 'MyAppTests' finished at 2012-08-18 14:30:27 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds

然后插入

- (void)testNothing {
}

进入MyAppTests.m并且警告消失了。

答案 2 :(得分:0)

我看到了类似的问题。

场景:使用单元测试创​​建一个新的iOS单视图应用程序。 Xcode使用testExample方法生成Tests类。 testExample有一个无条件的STFail(),所以测试应该总是失败。通过Command + U运行测试,10次Xcode中有9次说“Test Succeeded”。大约50%的时间10工具栏上也写着“没有问题”,另外50%它仍然显示错误,同时仍然说“测试成功”。

查看日志,总会有“所有测试未完成”警告。

这看起来像是一个计时问题:如果我在testExample中添加[NSThread sleepForTimeInterval:3],测试目标会一如既往地失败。

答案 3 :(得分:0)

有关可能的解决方法,请参阅我对此(重复)问题的回答:Some of my unit tests tests are not finishing in XCode 4.4

相关问题