title: What is the purpose of XCTestCase's setUp method?
body: <p>Per the comment within the default template for <code>XCTestCase</code> regarding <code>setUp</code> :</p>
  
  <p><code>Put setup code here; it will be run once, before the first test case.</code></p>
  
  <p>However, in <code>XCTestCase.h</code>, the comment above <code>setUp</code> states differently:</p>
  
  <p><code>Setup method called before the invocation of each test method in the class.</code></p>
  
  <p>To confirm the actual behavior, I put an <code>NSLog</code> within<code>setUp</code> to count how many times it was called:</p>
  
  <pre><code>static int count = 0;
  
  - (void)setUp
  {
      [super setUp];
      count++;
  
      NSLog(@"Call Count = %d", count);
  }
  </code></pre>
  
  <p>This resulted in the <code>setUp</code> method being called before every test method (confirming the comment on <code>XCTestCase.h</code>).</p>
  
  <p>I wanted to use the <code>setUp</code> method to create test/mock objects <strong>once</strong> (e.g. to setup a Core Data test stack). Creating these over and over again would be processor intensive and potentially very slow.</p>
  
  <p>So,</p>
  
  <p>1) What is <code>setUp</code> actually intended to be used for? Surely developers aren't creating objects in it over and over?</p>
  
  <p>2) How can I create these objects only <strong>once</strong> within an <code>XCTestCase</code>?</p>