After some serious frustration and headaches, I\'ve managed to add unit tests to an existing project. The problem is, the tests only get executed 50% of the time. I have a t
I took your fresh project and reproduced the problem. There are a number of issues, and one unknown:
Build Phases of test target:
Build Settings of test target:
$(BUILT_PRODUCTS_DIR)/TestApp.app/TestApp
$(BUNDLE_LOADER)
Scheme of main target:
But even if I make all these changes, your project still has the odd behavior. The simulator sometimes gets a version of the app named, literally, ${PRODUCT_NAME}. Even debugging the app sometimes shows "Debug ${EXECUTABLE_NAME}" in the Log Navigator. So something else is awry, and I don't know what.
The best solution is to create a new project from scratch, specifying "Include Unit Tests". I've verified that this works.