OCUnit Application vs. Logic Tests

One of the things that I learned at WWDC 2012 is that Apple has changed the definition of OCUnit Logic and OCUnit Application tests. Apple does not split OCUnit test into “Application” and “Logic” tests anymore. Instead, OCUnit test targets can optionally specify a “test host” in the target’s build settings. What we think of currently as “Application” unit tests are tests that have designated a test host. What we think of as “Logic” unit tests do not.

One of the useful side effects of this is that both types of tests can be run in the same  scheme and action. Previously I had been creating two separate schemes in my projects; one for the Application tests and one for the Logic tests. Both can actually be combined into a single scheme and run together if desired.


One thought on “OCUnit Application vs. Logic Tests

  1. Not sure how Apple changed the definition but it’s funny to see that their [Unit Testing Guide][1] still makes the distinction.

    AFAIK specifying a “test host” launches the simulator which is still required by “Application” tests. Sure you can have “Logical” ones running as well, but unit testing should have a fast turnaround. Fortunately, XCode can run “Logical” [tests after each build][2].

    You can still choose to run both types in the same scheme and action if you choose to do so. That is your default target, simply by hitting “Test CMD+U”, as long as you have [everything setup properly][3].

    [1]: https://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/UnitTesting/02-Setting_Up_Unit_Tests_in_a_Project/setting_up.html
    [2]: http://stackoverflow.com/questions/6980025/how-to-run-ocunit-logic-tests-automatically-before-each-build-run-of-ios-app-i
    [3]: https://www.dropbox.com/sh/0vyuku60vlurlc0/edfjNnUZOh/XCode%20Testing

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.