jcardenete
jcardenete

Reputation: 1656

XCTest: The bundle “target Tests” couldn’t be loaded because its executable couldn’t be located

I'm using XCode 6.2 and I have a project with several targets and with no tests.

I'm trying to include now XCTest for one of the targets. To do so, I add a new "Cocoa Touch Testing Bundle" and select the target that I want as a host.

When trying to launch the test with Cmd+U, the simulator launches, opens the app for some milliseconds and then it closes, launching this message:

IDEBundleInjection.c: Error 4 loading bundle '/Users/pepito/Library/Developer/Xcode/DerivedData/Flight-gpauuftblwwxtvevnylzllkypkjy/Build/Products/Debug-iphonesimulator/target Tests.xctest': The bundle “target Tests” couldn’t be loaded because its executable couldn’t be located.

When I check the folder specified there, there is a just the Info.plist file, but there is no executable.

I have tried adding a branch new app target, which added automatically tests for it. The same error happens there when trying to run the tests.

If I create tests for a target in a brand new XCode project, then it works fine.

Upvotes: 11

Views: 11847

Answers (4)

aclima
aclima

Reputation: 780

This was happening to me when trying to run Unit Tests for the Tests target.

The fix ended up being disabling the Host application.

xcodeproj menu > select the Test Target > General > Testing > Host Application > None

setting Host Application to None

Upvotes: 1

Mert Buran
Mert Buran

Reputation: 3017

In my case, target's iOS Deployment Target in Build Settings was lower than target device's version. Hope that helps someone.

Upvotes: 1

icecrystal23
icecrystal23

Reputation: 331

I got this error today because I forgot to add sources to the "Compile Sources" build phase in my test target.

Upvotes: 12

jcardenete
jcardenete

Reputation: 1656

I finally managed to solve the problem. It was related to the compiler selected by default for the XCTest target. It had selected "Unsupported Compiler" and I changed to "Default compiler (Apple LLVM 6.1)" and it started working again.enter image description here

Upvotes: 1

Related Questions