Re: Re: A better way to test the GUI?
Phlip <[email protected]>
| Newsgroups | gmane.comp.programming.test-driven-development,gmane.comp.programming.test-first-user-interfaces |
|---|---|
| Message-ID | <[email protected]> |
Anthony Williams wrote:
>
> That's why it's important to capture only your custom control, rather than the
> whole form--- you're testing that it draws correctly, so you need to make it
> draw. Once you know it draws correctly, then you can just test uses of it by
> querying its properties.
There are two better ways to TDD a custom control. The best is, of
course, to composite together smaller controls. The next best is to
use a full-featured canvas control that treats graphic primitives as
objects. Then the TDD cases can simply query those objects and their
properties, to see what the production code told them to do.
The next least worse way is to create a Mock Graphics object and pass
this into the control's Paint event handler. That's what the GDI layer
offers with metafiles.
The worst way is to compare images by pixels. But some get plenty of
milage out of that.
--
Phlip
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/testdrivendevelopment/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/