2

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?

Community
  • 1
  • 1
diego
  • 120
  • 10

2 Answers2

4

Do you have App Sandbox under Capabilities for your target enabled? Switching that off worked for me.

Tony J Stark
  • 306
  • 3
  • 11
  • Well, what if you need Sandboxing? I don't want to disable Sandboxing every time I want to run my Unit Tests... – IluTov Jan 31 '14 at 22:12
  • 1
    I also hit the same thing, and toggling off sandboxing helps. Too bad I of course need sandboxing in the app that I want to load into the tests... – mz2 Mar 02 '14 at 22:25
  • 2
    Ah, here's instructions for testing a sandboxed app: http://marcschwieterman.com/blog/testing-in-the-sandbox/ – mz2 Mar 02 '14 at 22:28
4

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/

Community
  • 1
  • 1
mz2
  • 4,672
  • 1
  • 27
  • 47
  • +1 Thank you so much. Why are not more people having this problem? The article you mention is from 2012 and the problem is still here.. – MartinW May 07 '14 at 09:51