title: Running individual XCTest (UI, Unit) test cases for iOS apps from the command line
body: <p>Is it possible to run individual test cases, or individual test suites, from an iOS app test target, instead of all the test cases, from a command line interface?</p>
  
  <p>You can run tests from command line with <a href="https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line" rel="noreferrer">xcodebuild</a>, out of the box. When you do so, you run all of the test cases contained in the test target you've selected.</p>
  
  <p>You can also do so with <a href="https://github.com/fastlane/scan" rel="noreferrer">scan</a> from Fastlane, though I believe you're restricted to running all of the tests of the build scheme you select (as above), so it's not different from xcodebuild.</p>
  
  <p>You can run specific tests with <a href="https://github.com/facebook/xctool" rel="noreferrer">xctool</a> from Facebook, but it doesn't use xcodebuild, and is restricted to running on simulators only, not actual iOS test devices.</p>
  
  <p>I found a reference to running the <a href="https://stackoverflow.com/questions/19988723/how-do-i-run-xctest-from-the-command-line-with-xcode-5">xctest</a> command line utility directly, but it seems to be an undocumented feature and targets DerivedData. This is complicated by the fact that UI Tests, <a href="https://github.com/facebook/xctool/issues/534#issuecomment-154790245" rel="noreferrer">have their *xctest files in a separate XCTRunner bundle</a>.</p>