我試圖從命令行運行單元測試,但它們在Xcode 4.6中運行完美時失敗。在我的測試無法從命令行運行Xcode單元測試由於錯誤
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).
如果有辦法,甚至打印出調用堆棧(英文),我也許可以找出錯誤所在距離。
你試圖運行應用程序測試而不是邏輯測試,對嗎?你有'ios-sim'正確安裝? – mAu
我有iOS模擬器應用程序,但是當我在命令行輸入'ios-sim'時,沒有任何東西。清單/Applications/Xcode.app/Contents/Applications顯示我有'iPhone Simulator.app'。 –
至於應用程序測試與單元測試的區別,這是一個作爲測試包創建的目標。我不確定是什麼把測試看作是「邏輯測試」和「應用測試」 - 整個概念對我來說似乎很不合理。無論如何,測試都來自SenTestCase。 –