Adding unit tests that run on a device to an existing Xcode 4 project

I am trying to add unit tests to an existing universal application in Xcode 4. I have been following tutorials, and while the logic tests are working fine in the simulator, when I try to test on the device, I get a dialog saying "Testing logic on iOS devices is not supported. You can run logic tests on the Simulator. " However, I noticed that when you create a new project in Xcode 4 and check the Include Unit Tests field, it actually installs and runs tests on the device. Am I missing an option somewhere that would allow me to incorporate this into my existing project?

+7
source share
1 answer

I think I figured it out by going through the lines through the build settings for the Cocoa Touch Unit Testing Bundle.

Build Settings

linker

  • Install the package loader in $(BUILT_PRODUCTS_DIR)/[Your App Name].app/[YourAppName]

Device testing

  • Install test node $(BUNDLE_LOADER)

Build Phases

Add application target to target dependencies.

Once you have done all this, you can simply connect your device and click β€œTest”.

+17
source

All Articles