
Unit testing
3 years ago
Why and how to do unit testing for Cocoa (Mac) applications using OCUnit, which comes with Xcode.
I'm not an iPhone developer, so please don't ask me about testing for iPhone applications. Instead, see this blog post by my friend Colin Barrett: iamthewalr.us/blog/2008/11/10/ocmock-and-the-iphone/
This video is based on a presentation I gave at the December 2008 meeting of CocoaHeads in Lake Forest, California. This version is corrected and expanded from the original.
I'm not an iPhone developer, so please don't ask me about testing for iPhone applications. Instead, see this blog post by my friend Colin Barrett: iamthewalr.us/blog/2008/11/10/ocmock-and-the-iphone/
This video is based on a presentation I gave at the December 2008 meeting of CocoaHeads in Lake Forest, California. This version is corrected and expanded from the original.
FLV
00:13:24
2 Related collections
| Date | Plays | Likes | Comments |
|---|---|---|---|
| Totals | 2,282 | 18 | 5 |
| Feb 14th | 0 | 0 | 0 |
| Feb 13th | 1 | 0 | 0 |
| Feb 12th | 1 | 0 | 0 |
| Feb 11th | 1 | 0 | 0 |
| Feb 10th | 0 | 0 | 0 |
| Feb 9th | 0 | 0 | 0 |
| Feb 8th | 2 | 0 | 0 |
-
Vimeo: About / Blog / Developers / Jobs /
Community Guidelines /
Help Center / Video School / Music Store / Site Map
/ Vimeo
or
-
Legal: TM + ©2012 Vimeo, LLC. All rights reserved. / Terms of Service / Privacy Statement / Copyright

Prev week
My question about testing in Cocoa is how to test singletons. For example, how would I test that a main menu item successfully calls an action on a custom controller? I can't mock up the main menu because it is effectively part of the NSApp singleton -- which I can't use in my test cases...
Thanks again -- and I love Adium too!
You can load the main menu nib explicitly. Pass your own object as File's Owner—you may get a warning because it's not an NSApplication, but as long as it has all the necessary outlets (e.g., mainMenu), it should just work.
I have noticed that (I think) OCUnit runs your tests in parallel. This has made testing a little more tricky for me. Some of my code wasn't designed to run in parallel -- although now it is because of OCUnit. Added bonus I guess!