Testing user interfaces can be challenging and often requires a bit more test scaffolding, as demonstrated in this example. However, the more code you can make testable, the more reliable the system will be. We could have taken the approach of traditional user interface testing mechanisms, but (as stated in the beginning of this chapter) most of them do not allow the incremental development style that we advocate here.
The approach outlined in this chapter builds most of the functionality outside the context of the user interface code, and we hook it up to the user interface only after the majority of the code is built. The approach used in this chapter yields user interface code that is just a thin layer on top of rigorously tested code.