【发布时间】:2011-01-01 10:04:51
【问题描述】:
当我遇到一点困难时,我已关注 this tutorial 在我的应用程序上设置单元测试。
在该教程的第 8 点,它显示了这张图片,这是我在构建时应该期待的:alt text http://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iphone_development/art/logic_test_failure_text_editor.jpg
但是,这不是我在构建时得到的。我收到此错误消息:Command /bin/sh failed with exit code 1 以及单元测试创建的错误消息。然后,当我扩展第一个错误时,我得到了这个:
PhaseScriptExecution "Run Script" "build/3D Pool.build/Debug-iphonesimulator/LogicTests.build/Script-1A6BA6AE10F28F40008AC2A8.sh"
cd "/Users/james/Desktop/FYP/3D Pool"
setenv ACTION build
setenv ALTERNATE_GROUP staff
...
setenv XCODE_VERSION_MAJOR 0300
setenv XCODE_VERSION_MINOR 0320
setenv YACC /Developer/usr/bin/yacc
/bin/sh -c "\"/Users/james/Desktop/FYP/3D Pool/build/3D Pool.build/Debug-iphonesimulator/LogicTests.build/Script-1A6BA6AE10F28F40008AC2A8.sh\""
/Developer/Tools/RunPlatformUnitTests.include:412: note: Started tests for architectures 'i386'
/Developer/Tools/RunPlatformUnitTests.include:419: note: Running tests for architecture 'i386' (GC OFF)
objc[12589]: GC: forcing GC OFF because OBJC_DISABLE_GC is set
Test Suite '/Users/james/Desktop/FYP/3D Pool/build/Debug-iphonesimulator/LogicTests.octest(Tests)' started at 2010-01-04 21:05:06 +0000
Test Suite 'LogicTests' started at 2010-01-04 21:05:06 +0000
Test Case '-[LogicTests testFail]' started.
/Users/james/Desktop/FYP/3D Pool/LogicTests.m:17: error: -[LogicTests testFail] : Must fail to succeed.
Test Case '-[LogicTests testFail]' failed (0.000 seconds).
Test Suite 'LogicTests' finished at 2010-01-04 21:05:06 +0000.
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.000) seconds
Test Suite '/Users/james/Desktop/FYP/3D Pool/build/Debug-iphonesimulator/LogicTests.octest(Tests)' finished at 2010-01-04 21:05:06 +0000.
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.002) seconds
/Developer/Tools/RunPlatformUnitTests.include:448: error: Failed tests for architecture 'i386' (GC OFF)
/Developer/Tools/RunPlatformUnitTests.include:462: note: Completed tests for architectures 'i386'
Command /bin/sh failed with exit code 1
现在这很奇怪,因为它正在运行测试(并且成功,因为您可以看到我的 STFail 触发),因为如果我添加一个通过的不同测试,我不会收到任何错误,所以测试工作正常。但是为什么我会得到这个额外的构建失败?
还可能需要注意的是,在下载应该可以解决问题的解决方案/模板时,我会遇到同样的错误。我猜我在这里设置了一些错误,但我只是 100% 正确地遵循了一个教程!
编辑:根据this blog、this post 和其他一些网站,我不是唯一遇到这个问题的人。自从 xCode 3.2 发布以来就是这样,假设苹果开发中心的文档和教程等也是 pre-3.2。
但是,有些人说这是一个已知问题,而其他人似乎认为这是故意的。我想要扩展控制台和代码消息,我当然不喜欢“命令/bin/sh ...”错误,并且真的认为他们会记录这样的更新。无论如何,希望它会尽快修复。
更新: 这是确认自 xCode 3.2.1 发布以来发生了一些变化。
这张图片: alt text http://ing0.co.uk/info/pics/unittest-xcode-3.2.1.png 来自我使用 3.2.1 的测试版本。这个来自旧版本(3.1.4): alt text http://ing0.co.uk/info/pics/unittest-xcode-3.1.4.png。 (两者的项目都没有改变)。
【问题讨论】:
-
我在 3.2.5(64 位 Intel Core i3,OSX 10.6.6)中遇到了同样的问题
-
很高兴你赏金,但我不太确定会有答案!
-
别过了,我似乎有测试工作。
标签: ios xcode unit-testing ios-simulator