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
I first experienced the joy of programming in junior high. But on the job, some of that joy was sucked away by seeing code my teammates were afraid to touch. Poor code led to fear, and fear led to our entire team being let go. I began searching for ways to improve code. I stumbled upon the first wiki, which was about Design Patterns, Extreme Programming, and Test Driven Development (TDD). I rediscovered joy on the job. I've now been doing TDD in Apple environments for 17 years. I'm committed to software crafting as a discipline, with the hope of raising you, my fellow programmers, to greater effectiveness and joy.
Please log in again. The login page will open in a new window. After logging in you can close it and return to this page.