XCode 5 unit testing: starts my app XCode 5 unit testing: starts my app xcode xcode

XCode 5 unit testing: starts my app


You are running application test, not logic test. This means an instance of your app will be started and then run the unit tests. This allow you to perform some integration test that require your app is running.

Here is the guide to setup application test and logic test.

If you want to change it to logic test (so it run faster and don't need to start your app first):

  1. go to build settings for your unit test target
  2. search Bundle
  3. remove Bundle Loader and Test Host

enter image description here


Thats right, you have to delete the "Bundle Loader" and "Test Host" from your build settings.

But you have to add the necessary implementation files to your unit test target. The necessary files are what you want to use in your unit test cases. You need to do this because in logic tests XCode wont compile the whole application. So some of your files will be missing.

This is en error message if you have left out a file:

Undefined symbols for architecture i386:  "_OBJC_CLASS_$_Module", referenced from:      objc-class-ref in Lobic Network.o      objc-class-ref in Logic_Unit.old: symbol(s) not found for architecture i386clang: error: linker command failed with exit code 1 (use -v to see invocation)

You can add the missing files by selecting the implementation file and bringing up the file inspector. There will be a section named "Target Membership" and there you can set the files target membership to your unit test also.


With XCTest, application files DO NOT need to be included within XCTest targets. The XCTest bundle is linked against the application which makes those files available during runtime.

To make this work, ensure the compiler option "Symbols hidden by default" is set to NO Within the Application target.

Here is a blog post with screenshots for clarity: http://zmcartor.github.io/code/2014/02/24/slim-xctest-targets

The advantage of this approach is test target builds much much faster.