Anyone successful in debugging unit tests for iPhone?

后端 未结 5 1885
Happy的楠姐
Happy的楠姐 2020-12-25 09:09

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 ru

相关标签:
5条回答
  • 2020-12-25 09:21

    The NSLog messages show up in Console.app

    Should give you a starting point.

    0 讨论(0)
  • 2020-12-25 09:25

    In Xcode 4, you can set breakpoints in your unit tests.

    1. Create a new project with "include unit tests" checked.
    2. Put a breakpoint in the failing unit test.
    3. Press Command-U to test.
    0 讨论(0)
  • 2020-12-25 09:28

    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.

    0 讨论(0)
  • 2020-12-25 09:30

    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)

    0 讨论(0)
  • 2020-12-25 09:35

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

    0 讨论(0)
提交回复
热议问题