How to run OCUnit logic tests automatically before each build (run) of ios app in xcode 4?

痴心易碎 提交于 2019-12-03 13:31:50

问题


It seems, that I have everything setup right. When I run command-u (or pick product - test from menu) test run fine.

Best practices should be, that test should run as often as possible, ideally during each build (understand during each run).

How to force XCode 4 to do it? I have tried to:

  • setup target dependency (put main app target to be dependent on test target)
  • enable "test after build" in main app target build settings
  • tick also test target in scheme editor for run main app scheme

but nothing seems to work. Does anyone have success setting up this?


回答1:


Finally figured it out, though still not perfect:

  1. On your test target make sure set "Test after build" to yes.
  2. On your main app scheme - build - under "run" tick also test bundle.

This makes your test target build when running the app. Thanks to "Test after build" also the tests run. If everything is ok, app starts in sim. If there are any failing tests, you get a crash, if you use STAssert. In case of OCMock, you can check what exactly went wrong in log inspector.

Sometimes breakpoints do not work. To get them working try product - perform action - test without building.



来源:https://stackoverflow.com/questions/6980025/how-to-run-ocunit-logic-tests-automatically-before-each-build-run-of-ios-app-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!