views:

1342

answers:

4

I found examples on how to debug your unit test in Cocoa or the ADC page here. But I can't get the debugging to work for an iPhone app target. I can get the tests up and running and they are run during the build, but what I need is to debug the tests for some of the more complex failures.

+2  A: 

The NSLog messages show up in Console.app

Should give you a starting point.

Kailoa Kadano
+5  A: 

You might consider moving your tests to GHUnit, where they run in a normal application target, so debugging is straightforward.

pokeb
This is exactly what I was looking for! :D
rik.the.vik
A: 

If you do Build & Go instead of just build, then you can set breakpoints in your unit tests and debug them traditionally. This is if you are using the google toolbox for iphone unit testing; i don't know how you are doing it and if the process is different.

Kevlar
I try this and not work. The debugger not get opened.
mamcx
+5  A: 

This can be done by setting up a separate Executable for the project that uses the otest tool to run the unit tests, after setting a bunch of relevant environment variables for the executable. I have used this method to successfully debug SenTestKit logic unit tests.

I found the following links helpful:

http://www.grokkingcocoa.com/how_to_debug_iphone_unit_te.html (also contains help to fix common errors encountered setting up the project).

http://cocoawithlove.com/2009/12/sample-iphone-application-with-complete.html (covers both logic tests and application tests)

http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/otest.1.html (Man Page for otest XCode tool)

beno