ing*_*.am 36 xcode unit-testing ios ios-simulator
当我遇到困难时,我已经按照本教程在我的应用程序上设置了单元测试.
在该教程的第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
Run Code Online (Sandbox Code Playgroud)
现在这是非常奇怪的,因为它正在运行测试(并且成功,因为你可以看到我的STFail发射),因为如果我添加一个不同的测试通过我没有错误,所以测试工作正常.但为什么我得到这个额外的构建失败?
还可能需要注意的是,当下载解决方案/模板时应该可以解决问题,我会得到同样的错误.我猜我在这里设置了一些错误,但我只是正确地遵循了100%的教程!
编辑:根据这篇博客,这篇文章和其他一些网站,我不是唯一一个得到这个问题.自xCode 3.2发布以来就是这样,假设苹果开发中心文档和教程等也是3.2之前的版本.
然而有些人说它是一个已知的问题,而其他人似乎认为这是故意的.我想要扩展控制台和代码消息,我当然不喜欢"Command/bin/sh ..."错误,并且真的认为他们会记录这样的更新.希望无论如何它很快就会被修复.
更新:这是确认自xCode 3.2.1发布以来发生了一些变化.
此图片: 替代文字http://ing0.co.uk/info/pics/unittest-xcode-3.2.1.png来自我使用3.2.1的测试版本.这个是旧版本(3.1.4): 替代文字http://ing0.co.uk/info/pics/unittest-xcode-3.1.4.png.(两者的项目没有变化).
双击"目标"/"您的脚本目标名称"下的"运行脚本",然后键入
# Run the unit tests in this test bundle. "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" 1> /tmp/RunUnitTests.out
基本上你需要追加
1> /tmp/RunUnitTests.out
已经存在的东西
您是否尝试过将测试用例的构建配置设置为“调试”?
我这样做了,如http://nothing2fancy.com/2009/08/04/failed-tests-for-architecture-i386-gc-off/所示,它有效