This screencast focuses on the question I get the most: “Do you do test-driven development for view controllers?” It’s clearly a roadblock for many people. This screencast should remove that roadblock.
It also answers the question, “Is it worth doing?”
- Three types of unit test verification
- View controller unit tests: the trick
- TDD demo
- How UIViewController TDD can actually help you code faster
…I did mess up something pretty big, and I don’t mean the nib and coding mistakes, which the unit tests successfully caught. I mean my failure to test the labels of the two buttons. I was so eager to show you how to test button behavior, that I forgot about how important it is to test button labels. So my apologies there, but I thought it was more important to get the information out than to try again.
- The first screencast, an Intro to Objective-C TDD
- My Resources page, where you can get OCHamcrest and my test case template
- Subscribe to this blog and I’ll send you my test code snippets
- Chris Hanson’s original blog post from July 2006 describing the trick
- Non-TDD UIViewController demo counter-ios, the basis for my example
See also: Testability vs. Information Hiding, a follow-up discussion about whether to expose outlets and actions in the interface.