How to run single test case in Xcode? How to run single test case in Xcode? xcode xcode

How to run single test case in Xcode?


Xcode 4 now have this feature. Simply create a "run scheme"  that has the test cases that you want to run.

  1. Open menu "Product|Edit Scheme..."
  2. Click on "Edit..."
  3. In the left pane, expand the "Test" section.
  4. In the right pane, expand the test bundle and uncheck the test cases you don't need to run.


+++U

You can also use the keyboard short cut of Control-Option-Command-U

Expert taken from Apple Documentation

Product > Perform Action > Test . This dynamic menu item senses the current test method in which the editing insertion point is positioned when you’re editing a test method and allows you to run that test with a keyboard shortcut. The command’s name adapts to show the test it will run, for instance, Product > Perform Action > Test testAddition. The keyboard shortcut is Control-Option-Command-U.


I'm sure that no one missed the release of Xcode 5 and its ability to easily run a single test case, but adding this answer just for completeness.

In Xcode 5 you can run a single test case by clicking the little play button that you can find next to the test in the test navigator or next to the test method in the editor. In both places it shows up when you hover over it.