title: How to set up working logic unit tests target in Xcode 4.5 "Command Line Tool" project?
body: <p>Having trouble getting unit tests set up for a specific scenario.  Here's what I'm trying:</p>
  
  <ul>
  <li><p>In Xcode 4.5, I created a simple OSX <strong>"Command Line Tool"</strong> application project (Foundation).<br>
  Note that Xcode <em>does not</em> provide the option to add unit tests to a "Command Line Tool" project automatically &ndash; so please don't suggest ticking the ticky-box; it ain't there :-/</p></li>
  <li><p>In my project, I created a trivial example class that I'd like to test; e.g. "Shape".</p></li>
  <li><p>I followed instructions in Apple's <em>Xcode Unit Testing Guide</em> for <strong><a href="http://developer.apple.com/library/mac/#documentation/developertools/Conceptual/UnitTesting/02-Setting_Up_Unit_Tests_in_a_Project/setting_up.html">Setting Up Unit-Testing in a Project</a></strong>:</p>
  
  <ul>
  <li><p>I added a unit test target to my project, and</p></li>
  <li><p>I edited the "Test" scheme to run the tests in the new target.</p></li>
  </ul></li>
  <li><p>In the test project's implementation (.m) file, I added an import for <code>Shape.h</code> and code in the <code>setUp()</code> method to instantiate a shape and assign it to an instance variable.</p></li>
  </ul>
  
  <p>At that point, I decided to see if things would build and if the default test would run still.  However, when I selected <strong>Product...Test</strong> from the menu, the build failed with the following error:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_OBJC_CLASS_$_Shape", referenced from:
        objc-class-ref in ExampleTests.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Interpreting this error is not the issue. I grok that the unit test target isn't being linked to the binary containing Shape's implementation.  However, I don't (yet) grok Xcode unit testing &amp; target configuration. So:</p>
  
  <p>What do I need to do in order to get the test target linking against the command line tool's resulting output?  Can I link to a command-line executable from the unit test target?  Apple's documentation looks specific to regular OSX applications (<code>*.app</code>) and iOS applications, and this is neither.</p>
  
  <p>I have business logic classes that I'd like to develop in a command-line tool setting (to begin with), so I'd like to understand what I need to do to get a unit test target running in a "Command Line Tool" type of project.  <em>Thank you!</em></p>
  
  <p>(p.s. Note that I'm <em>not</em> interested in running my unit tests <em>from</em> the command line &ndash; Stack Overflow already suggested "similar" questions on how to do that &ndash; but rather running unit tests <em>on</em> a "Command Line Tool" type <em>project</em>, and still from within Xcode.)</p>