views:

180

answers:

2

I have a suite of unit tests that I use before checking in my project. However, very often it's the case that only one of them finds some regression in the code. In these cases I'd like to only run that particular unit test while debugging the failure. I haven't found any way to do this in XCode. Is it possible?

+2  A: 

If you're happy restricting your testing to a single test class, a simple option is to create a second test target (duplicate the existing target, change the product name and remove the contents of the "Compile Sources" build phase, if you wish) and add only the test source file you're trying to fix to it.

Alternatively, you can use the "Other Test Flags" option to pass a -SenTest argument to otest, the test runner:

% /Developer/Tools/otest       
2009-08-29 22:28:39.555 otest[70089:10b] Usage: otest [-SenTest Self | All | None |
<TestCaseClassName/testMethodName>] <path of unit to be tested>

More information about using this method is here.

Nicholas Riley
A: 

Thanks for that push in the right direction. I ended using the same basic concept, but I added a GUI that lets you select what gets run as well as get a nice red/green status for each test. If anyone is interested, the code is at the URL below. The UI needs to more spit and polish, but it seems to be working.

http://github.com/nall/XcodeUnitTestGUI/tree/master

After I started the project above, I found this project which is really fantastic.

http://github.com/gabriel/gh-unit

nall