Search code examples
unit-testingxcode4ocunit

OCUnit: How to run tests without launching iPhone simulator?


I'm following iOS Development Guide: Unit Testing Applications. However, when I attempt to build (Command+B) the LogicTests target (step 8 of "Setting Up Logic Testing"), I get the error: "The selected run destination is not valid for this action."

Since I added my application target to LogicTests's target dependencies, I'm able to run the unit tests with Command+U, but this also launches the iPhone Simulator.

To save time & resources, is it possible to run the OCUnit tests (both logic & application tests) without launching the iPhone Simulator?


Solution

  • How much time/resources? Rather than focusing on reducing those, I'd focus on expanding your tests to go far beyond Apple's original "Logic Test" guidelines. Those guidelines were limiting, and written before Xcode 4. Now you can write tests without thinking, "Is this a logic test or an application test?" -- just test everything.