views:

1040

answers:

4

I'd been using OCUnit (the default installation that comes with XCode) in XCode 3.0. I've been happy being able to run my tests and see the results in the Build Results window, as well as any NSLog() messages I output.

However, with XCode 3.1 the tests run fine, but I suddenly lose my NSLog() output. Anybody know where it went?

+4  A: 

Just learning this stuff myself and had to poke around to answer that very question (XCode 3.1.2).

Go to the Build Results window after running. It may not open automatically, depending on configuration. Build / Build Results menu option will open it if needed.

In the middle area between the two panes, you'll see 4 buttons on the left. The 3rd icon is just 3-4 horizontal lines. Click that to toggle the build transcript. That shows all build steps and NSLog() output from the run.

John M
What I actually did was make a macro to wrap NSLog() and forgot to #define DEBUG in my Test project. But, I'll give you the answer because most people aren't boneheaded as I am ;)
sehugg
I don't see this button in my build results window in 3.2.1
jacob
The icon changed in 3.2 to be a black/yellow "gdb" icon. Equivalent to the Run / Console menu item (as mentioned by PiPeep).
John M
Command-Shift-B will take you there as well. And if you build your unit tests once you're already in that window, you shouldn't have to expand anything. In Xcode 3.2 (Snow Leopard) the "show log" button has disappeared, but you can select the *Run custom shell script 'Run Script'* line and click on the little bubble on the right side to expand the unit test log. Works for other build phases as well, such as compilation and linking.
Quinn Taylor
A: 

(on the menu-bar) Run -> Console (Shift-Apple-R)

PiPeep
A: 

For whatever reason, unit tests do not send their NSLog output to the console in the same way apps do. They do appear as explained above. However, that output is really long and messy and it's hard to find your output.

Also, once I clicked the button to view the entire log as described above, those four buttons vanished. So I can't go back to the way it was before I clicked that button.

A: 

While it's inconvenient, I found NSLog() messages going to the OSX Console.app.

Applications > Utilities > Console.app I filtered by otest to see output.

I couldn't get any of the above methods to work.

Zach Moazeni