Here are some popular ways to do this in general (should work with most, if not all cocoa compatible languages).
1 - create a callback interface. One of the inputs to creating your GUI elements is the implementation of this interface. When the user interacts, the GUI element calls the update function on this interface. Have a real implementation and test implementation.
2 - Use event handlers. Register all of your GUI elements with one or more event handlers and create GUI events to interact with the user. Have an event handler interface with two implementations, again one for real use and one for testing.
Edit: screams, missing requirement # 1. Never do this with special OSX controls, but overall there are two approaches.
1 - create a script or application that generates user input. It has the disadvantage that it is not easy for you to check the GUI. Instead, you need to create good test cases to make sure that everything should be there and there is nothing superfluous.
2 - create an interface with a test implementation that replaces the rendering and interface layer. This is easier with libraries like SDL or directFB, and even more so with things like OSX API, win32 API, etc.
Edit: response to editable.
In the case of your example, using a separate test application and event handlers, this looks like this:
Your test application is a simple application or script that launches your GUI and then generates mouse / keyboard events based on input files. As I said, I have never done this in OSX (QNX only). With any luck, you can generate mouse and keyboard events using the API, but you will have to ask someone if possible.
So, create an input for your test case. The test application will analyze this to know what to do. This could be plain XML:
<testcase name="blah"><mouseevent x="120" y="175" type="click"/></testcase>
or no matter what the mouse sequence may actually be.
When your script executes this command, it clicks on this button. Your event handler will pick this up. But now you have to run your application with the -test or somesuch flag in order to actually use the test event handler. Instead of doing what your application usually does, the test event handler can perform some user actions. For example, it can perform some ordinary actions (you still need a GUI to respond), and then send the message (via socket, pipe, whatever) to the test application.
Your test application will pick up this message and compare it with what it expects to see. So now, maybe your test XML file looks like this:
<testcase name="blah"> <mouseevent x="120" y="175" type="click"/> <response>doMyItem() called</response> </testcase>
If the response generated by the event handler is different, then the test case failed. You can print the actual answer to help with debugging.