iphone: cannot link gh-unit target to app target, cannot execute binary file

479 Views Asked by At

this is a question that tries to accomplish what this tutorial offers with a GHUnit Test Target. Its about linking a test target to the source target so that you dont have to manually include the source files in the test target. The following is an excerpt of the solution proposed.

Adding Unit Tests to an existing iOS project with Xcode 4

Project MyExistingApp -> + Add Target -> iOS -> Other -> Cocoa Unit Testing Bundle

Name the new target something like “Unit Tests” or “MyAppTests”

Select your new “Unit Tests” target and click the Build Phases tab, expand Target

Dependencies and add MyExistingApp as as a Target Dependency

Click the Build Settings tab and set the Bundle Loader setting to

$(BUILT_PRODUCTS_DIR)/MyExistingApp.app/MyExistingApp

Set the Test Host build setting to

$(BUNDLE_LOADER)

In your app target, set the Symbols Hidden by Default build setting to

NO

I get it to compile with a GHUnit Test Target following the tutorial, but I get a runtime error:

warning: This configuration supports "Darwin64" but is attempting to load
an executable of type i386 which is unlikely to work.
Attempting to continue.
`/usr/lib/dyld' has changed; re-reading symbols.
warning: Inconsistent DBX_SYMBOL_SIZE

/Users/...Tests.app/Tests: /Users...Tests.app/Tests: cannot execute binary file

Appreciate your help!

EDIT

I realize that there is a catch with the tutorial posted above and using GHUnit. The tutorial above assumes you are using OCUnit, wich launches a bundle loader target. The GhUnit target must however be an executable. If somebody wants to share how to link source files to an Executable target Ill appreciate it. For now, im going to do everything manually with GHUnit.

1

There are 1 best solutions below

0
On

Not sure if this is the RIGHT answer, but it worked for me:

I got the GHUnits testcases, and wrapped them with SenTestCases. XCode automatically calls SenTestsCases, so I didn't any trouble to run the tests.

Worked like a charm, got my async tests without any more worries.