title: Target individual XCTest unit test cases in Xcode 5 to a specific iOS device for a universal app?
body: <p>I'm building a universal iPhone/iPad application, and the UI is significantly different in some cases (i.e. on iPhone we use a Master/Detail paradigm with TableViews, whereas on iPad we're using a CollectionView with cells that contain the details).</p>
  
  <p>Because the interfaces are so different, it changes how the unit tests for the view controllers are constructed. In the collection view, we'd have to test to make sure the cells get built correctly and contain all the detailed information, whereas on iPhone we'd need two sets of tests - one for the master list and one for the detail screen.</p>
  
  <p>So my question is, in a universal application being built using Xcode 5 with XCTest framework, can you target individual unit test cases / classes to be run on specific <strong>physical</strong> devices?</p>
  
  <p>I came across a similar question here - <a href="https://stackoverflow.com/questions/10134046/ios-unit-testing-universal-application">iOS Unit testing universal application</a> - but the asker had different intentions and was using older technologies.</p>
  
  <p>I've also seen recommendations to do a check in individual test functions for <strong>UserInterfaceIdiom</strong> but that seems really crude. Ideally, there would be an annotation that would designate specific tests run on specific devices, or be able to designate an entire test class for a specific device.</p>
  
  <p>Thanks in advance for your suggestions.</p>
  
  <p>--EDIT--</p>
  
  <p>@TommieC led me down what seems to be the appropriate path, if a smidge manual. I created two new testing specific schemes, one for phone-sized devices, and one for tablet-sized devices. Inside those schemes, I edited the test portion and added in the core tests along with the device-specific tests.</p>
  
  <p>I then have jenkins execute two build steps, targeting the appropriate devices to test for the particular scheme. The downside to this approach is two build steps. However, I plan to split up the jenkins job and run it on 2 slaves with the appropriate devices hooked to each to parallelize the testing.</p>
  
  <p>AFAIK this will also be Xcode Build Services friendly, as it works based off of schemes in a project as well. It's really too bad there isn't something more elegant built into XCTest for this, considering this doesn't scale terribly well in the event a new device type comes into play (watch/tv/hair dryer/etc.)</p>