How to run OCUnit logic tests automatically before each build of an ios application in xcode 4?

Everything seems to be set correctly for me. When I run the -u command (or select the product - test from the menu), the test run runs fine.

The best practice should be that the test should be performed as often as possible, ideally during each build (understood during each run).

How to get Xcode 4 to do this? I tried:

  • set the target dependence (set the main goal of the application depending on the target goal).
  • enable "test after build" in the main build settings of the target application.
  • Also check the test target in the schematic editor to launch the main application schema.

but nothing works. Does anyone succeed in customizing?

+6
source share
1 answer

Finally I realized, although still not perfect:

  • In the test target program, verify that Test After Build is set to Yes.
  • In your main application scheme - build - under "run" also check the test suite.

This makes your test target build at application startup. Thanks to "Test after build" tests also pass. If everything is in order, the application runs in sim. If there are any failed tests, you get a failure if you use STAssert . In the case of OCMock you can check what exactly went wrong in the log controller.

Sometimes breakpoints do not work. To make them work, try the product - perform the action - test without assembly.

+10
source

Source: https://habr.com/ru/post/894527/


All Articles