TDD is a series of small steps. It can be difficult to grasp until you see those steps demonstrated.
That’s why I made this screencast. It was sparked by a Stack Overflow question that said, “All the examples of unit testing I read about seem to be extremely simple and trivial.” The question asks how to write unit tests for a piece of sample code that uses NSUserDefaults.
Bonus content: In addition to the screencast, I put together a bonus Git repository that shows you exactly how I’d TDD the problem, updated to my latest practices. You can access the bonus content here.
Question: What still remains puzzling or challenging about applying TDD to iOS development? Leave a comment below.
See also: How to Do UIViewController TDD
Programming was fun when I was a kid. But working in Silicon Valley, I saw poor code lead to fear, with real human costs. Looking for ways to make my life better, I learned about Design Patterns, Refactoring, and Test-Driven Development (TDD). Programming became fun again! I've now been doing TDD in Apple environments for 17 years. I'm committed to software crafting as a discipline, hoping we can all reach greater effectiveness and joy.
Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.