我正在尝试从命令行运行单元测试,但它们在 Xcode 4.6 中运行得非常好时失败了。我无法弄清楚失败的原因是什么:
这是我正在使用的命令:
xcodebuild -sdk iphonesimulator -project myproject.xcodeproj
-scheme 'MyProjectApplicationTests'
-configuration Debug clean build
RUN_UNIT_TEST_WITH_IOS_SIM=YES TEST_AFTER_BUILD=YES TEST_HOST=''
在我的测试中,我没有使用 NSURL 或“initFileURLWithPath”。这是错误:
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include:412: note: Started tests for architectures 'i386'
Run unit tests for architecture 'i386' (GC OFF)
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include:419: note: Running tests for architecture 'i386' (GC OFF)
2013-06-04 22:09:57.605 otest[85321:707] Unknown Device Type. Using UIUserInterfaceIdiomPhone based on screen size
2013-06-04 22:09:57.624 otest[85321:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** First throw call stack:
(0xa05012 0x71ce7e 0xa04deb 0x2a9b1 0x2a93b 0x4d3c5c9 0x71d7cf 0x724a0d 0x71baeb 0x71be22 0x72e0e1 0x2010879a 0x20106ef5 0x20107124 0x20107196 0x2010624c 0x201063da 0x7305c8 0x2342 0x25ef 0x268c 0x2001 0x1f71)
libc++abi.dylib: terminate called throwing an exception
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include: line 415: 85321 Abort trap: 6 "${THIN_TEST_RIG}" "${OTHER_TEST_FLAGS}" "${TEST_BUNDLE_PATH}"
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include:451: error: Test rig '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Developer/usr/bin/otest' exited abnormally with code 134 (it may have crashed).
如果有办法甚至打印出调用堆栈(英文),我也许可以找出错误来自哪里。