• 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: How to step through unit test bundle execution in Xcode 2.1?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to step through unit test bundle execution in Xcode 2.1?


  • Subject: Re: How to step through unit test bundle execution in Xcode 2.1?
  • From: Chris Hanson <email@hidden>
  • Date: Thu, 7 Jul 2005 18:59:22 -0700

On Jul 7, 2005, at 5:48 PM, Rush Manbert wrote:
I'm hoping that one of the Apple guys will read this and tell me how to use unit tests with the debugger. Since I wrote my test as soon as I finished writing the class under test, I really wanted to use the test code as a way to step through my class code and watch the data while it executed. Is this not possible?

Below is a modified version of what I posted about this in June; it describes what you need to do to debug into a C++ application that uses CPlusTest for its testing framework.  The instructions I posted in June are for an Objective-C Cocoa application that uses OCUnit for its testing framework.  This all assumes you're creating an application and a test bundle for it, and that you've set your test bundle up properly for testing the application (e.g. that you specified its Test Host and Bundle Loader build settings as described in the Unit Testing Guide).

...

You'll need to set up your application executable in Xcode to support debugging into your tests, by specifying two environment variables.  You can do this by highlighting your application in the Executables group of your Xcode project and getting info on it, at the bottom of the inspector you'll see a table view where you can set environment variables and their values.

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 when the helper library itself is loaded.  Here's how you should set them:

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

XCInjectBundle=$(BUILT_PRODUCTS_DIR)/YourTestBundleName.cptest

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.  Since unit tests are run after your built products are created, this will work.)

  -- 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

  • Follow-Ups:
    • Re: How to step through unit test bundle execution in Xcode 2.1?
      • From: Rush Manbert <email@hidden>
References: 
 >How to step through unit test bundle execution in Xcode 2.1? (From: Rush Manbert <email@hidden>)

  • Prev by Date: Re: undefined __throw
  • Next by Date: Re: undefined __throw
  • Previous by thread: How to step through unit test bundle execution in Xcode 2.1?
  • Next by thread: Re: How to step through unit test bundle execution in Xcode 2.1?
  • Index(es):
    • Date
    • Thread