title: iOS UI Testing with Mocks and Screenshots
body: <p>I want to setup a UI testing system with iOS that allows me to test just a single ViewController OR UIView such that</p>
  
  <p>a) I can provide it with Mocked data
  b) I can render its view to the simulator 
  c) I can take a Screenshot of it, save it to disk and aggregate the snapshots (like snapshot)</p>
  
  <p>Why?
  1) The QA team wants to quickly verify UI's still look the way they should
  2) We want to be able to quickly iterate the appearance of deeply located, complex programmatic View's which Interface Builder cannot support in any meaningful way.</p>
  
  <p>The Xcode 7 UI Testing does not suit this purpose since you cannot actually compile any of the original code. </p>
  
  <p>The Logic XCTest framework seems like a better fit however, it understandably is reluctant to render anything to the screen. I don't care: I want something rendered to the screen.</p>
  
  <p>Please spare me your dogmatic philosophic diatribes about the one true TDD and UI vs Logic testing. This is perfectly possible with Android Studio and I've used it to much success.</p>
  
  <p>Thanks in advance for any help.</p>
  
  <p>Example</p>
  
  <p></p>
  
  <pre><code>Model * model = [[MockModel init] alloc]
  model.value = @(10)
  
  UIViewController * importantViewController= [[ImportantViewController alloc] initWithModel:model];
  
  TestAppDelegate *appDelegate = (TestAppDelegate *)[UIApplication sharedApplication].delegate;
  
  UINavigationController *navController = (UINavigationController*)appDelegate.window.rootViewController;
  
  [navController pushViewController:importantViewController animated:NO];
  
  TakeSnapshot("Important01")
  </code></pre>
  
  <p></p>