[TFUI] Re: [TDD] Testing Dialogs
"Phlip" <[email protected]> Tue, 17 Oct 2006 07:30:47 -0700
| Newsgroups | gmane.comp.programming.test-first-user-interfaces,gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <00a201c6f1f8$d825d7e0$81a1b04c@Marley> |
Anderson, Kelly wrote:
> I have an interesting approach to testing dialogs that I don't recall
> seeing discussed on this list before, so I thought I'd share the
> technique. Basically, you bring the dialog up on a separate thread, then
> you remote control the dialog and see if you get the expected result.
> t = new Thread(new ThreadStart(OpenDialog));
> t.Start();
> Thread.Sleep(1500); // wait for dialog to come up... then run test.
Tip: Pass a testing object into the thread, and let that throw a semaphore.
Then block on the semaphore here.
However, in general, Dialogs often block as a programmatic convenience, so
the same function as calls them can collect their return value and keep
going.
False conveniences are bad for event-driven and test-ready programming. If
you instead create a modeless dialog, you can disable the underlying window,
and get exactly the same behaviors as a modal dialog. Then your test can
stay in one thread, and can operate the event queue to send the dialog
messages.
--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
To unsubscribe, email:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/TestFirstUserInterfaces/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/TestFirstUserInterfaces/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:TestFirstUserInterfaces-digest-hHKSG33TihhbjbujkaE4pw@public.gmane.org
mailto:TestFirstUserInterfaces-fullfeatured-hHKSG33TihhbjbujkaE4pw@public.gmane.org
<*> To unsubscribe from this group, send an email to:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/