Sunday, October 18, 2009

Debugging Individual CPlusTestRig Test Cases

Having got the unit tests working in the debugger I don't really want all the tests to be executed each time I run the debugger. I just want to work with the problem test.

The easiest method I know of is just linking in the tests that you want. It is what I have used in the past when fixing unit tests (prior to getting the debugger to work I used NSLog calls and just looked at the output - my programming start predates symbolic debuggers and if you go old school you can still find bugs and fix things).

I have named all my tests files so that they end in _test and then the file suffix. This means that I can: 


  1. Select all my test files in the search widget in XCode by typing _test.cpp and then in the main area choose the tests that I do not want
  2. Click on the Info button in the tool bar to get info on all of the tests
  3. Select the Targets pain in the info window and turn off the tests that I don't want to run.


As I have boith .cpp and .mm files this is actually a two stage process - but it is very simple to do.

No comments: