Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't debug unit test




On Jul 27, 2008, at 10:58 PM, Tron Thomas wrote:

I'm using Xcode 3.1, and I'm trying to debug a Objective-C unit test written with OCUnit. Despite setting what should be the appropriate environment variables Xcode never hits the break points I set. The application simply runs to completion.

What could possibly be needed to allow debugging of the unit test?


Chris Hanson's directions are not up-to-date for 3.1. If you browse through the comments you will find an anonymous poster who mentions what you need to do. In 3.1 you also need to add an environment variable XCInjectBundleInto which is the full path to the executable. The DevToolsBundleInjection will also log a message to the debug console informing you that you need to specify the XCInjectBundleInto environment variable if it was not specified.


For quick reference you need to do the following:

Add the argument "-SenTest All" to the executable.

Add the following environment variables to the executable:

Name: DYLD_INSERT_LIBRARIES
Value: $(DEVELOPER_LIBRARY_DIR)/PrivateFrameworks/ DevToolsBundleInjection.framework/DevToolsBundleInjection


Name: DYLD_FALLBACK_FRAMEWORK_PATH
Value:$(DEVELOPER_LIBRARY_DIR)/Frameworks

For the following two environment variables I would suggest specifying the entire path in the value to verify that debugging works. After you verify that you can break on breakpoints in your test cases then you may wish to substitute with the appropriate environment variables.

Name: XCInjectBundle
Value: /Volumes/Backup/TestUnit/build/Debug/Tester.octest <- change this to your path


The Following environment variable is new in 3.1 and not mentioned in Chris Hanson's instructions as of this writing.
Name: XCInjectBundleInto
Value: /Volumes/Backup/TestUnit/build/Debug/TestUnit.app/Contents/ MacOS/TestUnit <- change this to your path


With the active target the Unit Test Bundle you created, active build configuration of Debug, and active Executable the one you specified the above environment variables and arguments for, select Debug from the Run menu. It should now stop on any breakpoint you have in your test cases.

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


This email sent to email@hidden
References: 
 >Can't debug unit test (From: Tron Thomas <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.