开发者

Adding Unit Tests that run on device to Existing Xcode 4 Project

I'm trying to add unit tests to an existing universal app in Xcode 4. I've followed the tutorials and while the logic tests run fine in the simulator, when I try to test on device I get a dialog saying开发者_StackOverflow中文版 "Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator." However, I've noticed that when you create a new project in Xcode 4 and check the Include Unit Tests box, it will actually install and run the tests on device. Am I missing an option somewhere that would allow me enable that on my existing project?


I think I figured it out by going line by line through the Build Settings for the Cocoa Touch Unit Testing Bundle.

Build Settings

Linker

  • Set Bundle Loader to $(BUILT_PRODUCTS_DIR)/[Your App Name].app/[YourAppName]

Unit Testing

  • Set Test Host to $(BUNDLE_LOADER)

Build Phases

Add the application target to the Target Dependencies.

Once you do all that, you can just hook up your device and hit Test.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜