My problem is my test will run in the debugger, but will not stop at my breakpoints and let me step through my test case code.
If somewhat could tell me what is wrong, I would be most appreciative.
Here's how I've got the whole thing set up:
I called my project AFramework.
I created my test target using the instructions in
Apple's Unit Testing Guide. That didn't have the specifics for how to set it up if you are testing a framework, so I ended up with the following settings:
test target name is AFramerworkTestTarget.
test target is dependent on AFramework
no Bundle Loader specified
no Test Host specified
no Test Rig specified
added to the other linkers flags: -framework AFramework
At this point the tests run when I build AFramerworkTestTarget and I can see all of the test results and my NSLog output in the build results window.
So far, so good. However, a couple of tests failed, so I would like to step through the test case code in the debugger to see what's going on.
Using info gathered from this list and the instructions in Apple's Xcode 2.1 User Guide I created a
custom executable that points to otest and has the following settings:
General Pane:
executable path: /Developer/Tools/otest
working directory set to Build Products directory
Arguments Pane:
Arguments to be passed on launch are:
-SenTest All
AFramerworkTestTarget.octest
Variables to be set in the environment are:
DYLD_INSERT_LIBRARIES = /System/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection
XCInjectBundle = $(BUILT_PRODUCTS_DIR)/AFramerworkTestTarget.octest
To run, first I click "Build" and get the results in the build results window. Then I click "Debug" to run it in the debugger.
This is the debugger console output, which shows it running in the debugger, having knowledge of the breakpoints I set (see the lines that say pending breakpoint resolved), but never stopping at the breakpoints or showing my test code in the debugger window.
[Session started at 2005-07-15 00:29:15 -0700.]
GNU gdb 6.1-20040303 (Apple version gdb-413) (Wed May 18 10:17:02 GMT 2005)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin".
Loading program into debugger…
tty /dev/ttyp2
Program loaded.
run
[Switching to process 6846 local thread 0xf03]
Running…
Pending breakpoint 1 - ""MyTestCase.m:151" resolved
2005-07-15 00:29:19.695 otest[6846] +[NSATSGlyphGenerator initialize] invocation. The class is deprecated.
Test Suite 'All tests' started at 2005-07-15 00:29:19 -0700
Test Suite '/System/Library/Frameworks/SenTestingKit.framework(Tests)' started at 2005-07-15 00:29:19 -0700
Test Suite 'SenInterfaceTestCase' started at 2005-07-15 00:29:19 -0700
Test Suite 'SenInterfaceTestCase' finished at 2005-07-15 00:29:19 -0700.
Passed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite '/System/Library/Frameworks/SenTestingKit.framework(Tests)' finished at 2005-07-15 00:29:19 -0700.
Passed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
Test Suite 'AFramerworkTestTarget.octest(Tests)' started at 2005-07-15 00:29:19 -0700
Test Suite 'MyTestCase' started at 2005-07-15 00:29:19 -0700
2005-07-15 00:29:19.770 otest[6846] Beginning MyTestCase
/Users/amy/AFramework/MyTestCase.m:165: error: -[MyTestCase testBasicFunctions] : "status" should be true. Failure location: Test 5, step 1
/Users/amy/AFramework/MyTestCase.m:197: error: -[MyTestCase testBasicFunctions] : "status" should be true. Failure location: Test 5, step 4
2005-07-15 00:29:21.081 otest[6846] Exiting MyTestCase
Test Case '-[MyTestCase testBasicFunctions]' failed (1.311 seconds).
Test Suite 'MyTestCase' finished at 2005-07-15 00:29:21 -0700.
Passed 1 test, with 2 failures (0 unexpected) in 1.311 (1.312) seconds
Test Suite 'AFramerworkTestTarget.octest(Tests)' finished at 2005-07-15 00:29:21 -0700.
Passed 1 test, with 2 failures (0 unexpected) in 1.311 (1.312) seconds
Test Suite 'All tests' finished at 2005-07-15 00:29:21 -0700.
Passed 1 test, with 2 failures (0 unexpected) in 1.311 (1.314) seconds
Debugger stopped.
Program exited with status value:1.(gdb)