Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCTest - "Test failed"

I'm trying to add tests to a mac app. I'm using XCTest framework. When i run tests (cmd + U) i receive "Test failed" and in console I see :

2013-10-15 13:22:56.354 8tracks Radio[40560:303] Error loading /Users/victor/Library/Developer/Xcode/DerivedData/Musica-dhxbqwburbddtietormguodcwoqt/Build/Products/Test/MusicaTests.octest/Contents/MacOS/MusicaTests:  dlopen(/Users/victor/Library/Developer/Xcode/DerivedData/Musica-dhxbqwburbddtietormguodcwoqt/Build/Products/Test/MusicaTests.octest/Contents/MacOS/MusicaTests, 262): no suitable image found.  Did find:
/Users/victor/Library/Developer/Xcode/DerivedData/Musica-dhxbqwburbddtietormguodcwoqt/Build/Products/Test/MusicaTests.octest/Contents/MacOS/MusicaTests: open() failed with errno=1IDEBundleInjection.c: Error loading bundle '/Users/victor/Library/Developer/Xcode/DerivedData/Musica-dhxbqwburbddtietormguodcwoqt/Build/Products/Test/MusicaTests.octest'

Any ideas? Cheers!

like image 822
Tatarasanu Victor Avatar asked Oct 15 '13 10:10

Tatarasanu Victor


2 Answers

You need to disable code signing in order to run unit tests. This page explains how to create a configuration for testing so that your debug and release applications are code signed but your unit tests are not. Don't forget to do a full clean after changing the configuration.

like image 116
Benjamin Smith Avatar answered Nov 14 '22 13:11

Benjamin Smith


I had the same "no suitable image found" issue when was trying to add tests to an existing ios project. Try to go to Build Settings of your Tests target and set "Build Active Architecture Only" to "No". This solved my issue.

Also, make sure you have the same Architecture for both targets or you'll get strange linker errors.

like image 43
mekarthedev Avatar answered Nov 14 '22 12:11

mekarthedev