I get the following message from Xcode when I try to run my tests:
2013-11-13 09:02:57.849 MyProject[378:303] Error loading /Users/tatami/Library/Developer/Xcode/DerivedData/MyProject-gcralijdlibafgeyfwfeiynnothy/Build/Products/Debug/MyProjectTests.xctest/Contents/MacOS/MyProjectTests: dlopen(/Users/tatami/Library/Developer/Xcode/DerivedData/MyProject-gcralijdlibafgeyfwfeiynnothy/Build/Products/Debug/MyProjectTests.xctest/Contents/MacOS/MyProjectTests, 262): no suitable image found. Did find:
/Users/tatami/Library/Developer/Xcode/DerivedData/MyProject-gcralijdlibafgeyfwfeiynnothy/Build/Products/Debug/MyProjectTests.xctest/Contents/MacOS/MyProjectTests: open() failed with errno=1
IDEBundleInjection.c: Error loading bundle '/Users/tatami/Library/Developer/Xcode/DerivedData/MyProject-gcralijdlibafgeyfwfeiynnothy/Build/Products/Debug/MyProjectTests.xctest'
This question has already been asked here: Xcode 5 throws "Library not loaded" error when adding a test target but the solution doesn't apply to me as this is a Mac app. Any ideas?
Do you have App Sandbox under Capabilities for your target enabled? Switching that off worked for me.
mz2
This is because of sandboxing.
Same issue also happens with OCUnit (in both Xcode 4 and 5): XCTest - "Test failed"
There's instructions for testing a sandboxed app here: http://marcschwieterman.com/blog/testing-in-the-sandbox/
来源:https://stackoverflow.com/questions/19956390/xcode-5-tests-not-running