• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Debugging Unit Tests
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging Unit Tests


  • Subject: Re: Debugging Unit Tests
  • From: Chris Hanson <email@hidden>
  • Date: Fri, 10 Jun 2005 13:12:55 -0700

On Jun 10, 2005, at 6:42 AM, Jesse Grosjean wrote:
But sometimes (when the tests don't run) I would like to set breakpoints in my test cases and break into XCode's debugger. Is that possible? How do I turn debugging on for the new built in unit testing?

It is possible, you'll need to set up your application executable in Xcode to support this.  You'll need to specify an argument and two environment variables.  You can do this by highlighting your application in the Executables group of your Xcode project and getting info on it.

The argument you'll need to specify is "-SenTest All" - this indicates to the testing framework that it should run all tests.

The environment variables you'll need to specify are DYLD_INSERT_LIBRARIES and XCInjectBundle.  You use DYLD_INSERT_LIBRARIES to force a helper library we've supplied to load into your application when it's launched.  XCInjectBundle gives that library the path to a bundle of unit tests to load.  Here's how you should set them:

DYLD_INSERT_LIBRARIES=/System/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection

XCInjectBundle=$(BUILT_PRODUCTS_DIR)/YourTestBundleName.octest

Once you do this, you should be able to set breakpoints in your unit tests and then launch your application under the debugger.  (Be sure, of course, to use "Debug" rather than "Build & Debug" so you aren't prevented from running under the debugger by unit test failures during build.)

  -- Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Debugging Unit Tests (From: Jesse Grosjean <email@hidden>)

  • Prev by Date: Re: XCode 2.1 header paths, source trees, and quotes
  • Next by Date: Xcode 2.1 dependency problems.
  • Previous by thread: Debugging Unit Tests
  • Next by thread: Re: Debugging Unit Tests
  • Index(es):
    • Date
    • Thread