[英]Running unit tests from the command line fail after upgrading to Xcode 5.1
升级到Xcode 5.1后,从命令行运行的单元测试停止工作。
以下是运行xcodebuild test -workspace MyApp.xcworkspace -scheme MyApp -sdk iphonesimulator -configuration Debug
时发生的情况xcodebuild test -workspace MyApp.xcworkspace -scheme MyApp -sdk iphonesimulator -configuration Debug
[...]
2014-03-11 15:32:08.392 Test Host[67583:907] Error loading /Users/0xced/Library/Developer/Xcode/DerivedData/MyApp-cdhjwjcbamuhpvfislepygilkusg/Build/Products/Debug-iphonesimulator/MyApp Tests.xctest/MyApp Tests: dlopen(/Users/0xced/Library/Developer/Xcode/DerivedData/MyApp-cdhjwjcbamuhpvfislepygilkusg/Build/Products/Debug-iphonesimulator/MyApp Tests.xctest/MyApp Tests, 262): Library not loaded: /Developer/Library/Frameworks/XCTest.framework/XCTest
Referenced from: /Users/0xced/Library/Developer/Xcode/DerivedData/MyApp-cdhjwjcbamuhpvfislepygilkusg/Build/Products/Debug-iphonesimulator/MyApp Tests.xctest/MyApp Tests
Reason: image not found
IDEBundleInjection.c: Error loading bundle '/Users/0xced/Library/Developer/Xcode/DerivedData/MyApp-cdhjwjcbamuhpvfislepygilkusg/Build/Products/Debug-iphonesimulator/MyApp Tests.xctest'
** TEST SUCCEEDED **
虽然xcodebuild报告** TEST SUCCEEDED ** ,但测试显然没有运行。
我该如何解决这个错误?
该错误表示/Developer/Library/Frameworks/XCTest.framework/XCTest
。 因此,为了解决这个问题,我使用以下脚本向我的单元测试目标添加了一个运行脚本阶段:
install_name_tool -change "/Developer/Library/Frameworks/XCTest.framework/XCTest" "${SDKROOT}/Developer/Library/Frameworks/XCTest.framework/XCTest" "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
它告诉单元测试包从当前SDK而不是从不存在的/Developer
目录加载XCTest框架。
令人惊讶的是,此修复程序仅在我的计算机上需要,但在我们的CI服务器上不需要。 我的机器和CI服务器之间的差异分别包括:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.