Test-First and GUI development
John Lam makes some interesting observations about test-first as it relates to GUI development:
I've been spending a fair amount of time recently writing GUI rendering code. I've also been spending a fair amount of time recently grappling with unfamiliar API's. These experiences have revealed two areas where test-first development doesn't quite work:
- GUI rendering code where "correctness" is determined by how something must look
- Early stage implementation where interface churn is the norm
The first case encompasses virtually all of GUI development, regardless of whether your GUI is an HTML page or a traditional Windows application. In these cases, whether or not something is "correct" depends on how an object appears. Unfortunately, there are usually several different ways to render the object, all of which yield correct results. Furthermore, it's really hard to determine how an object is rendered programmatically, whereas it is usually quite simple for a human to determine if an object looks "correct".
Yeah, I can definitely see that. A lot of the GUI is subjective rather objective. A test can tell you conclusively whether or not a transaction happened - it can't tell you whether the foreground and background colors are frelled. Ultimately, you're going to have to do some human factors work.


Comments
TDDing GUIs & early stage
[DaveAstels] March 11, 2003 13:56:53.567
Yes, you can test-drive the functional aspects of a GUI, but the visual aspects are best done visually. There are human-factors guidelines that help, but it comes down to someone looking at it. I disagree however about TDD not being applicable to early stage development. TDD is how you design your api. Dave Astels (author of Test-driven Development: A Practical Guide)