RE: [TFUI] Re: [TDD] Testing Dialogs

"Anderson, Kelly" <[email protected]> Tue, 17 Oct 2006 09:50:00 -0600
Newsgroups gmane.comp.programming.test-first-user-interfaces
Message-ID <[email protected]>
I would create a modeless window given a choice. But I don't have a
choice.

Perhaps you are suggesting that I use a modeless window for testing,
even if the window is modal in the real program? 

I'd be really interested in an example of the semaphore technique. I
don't have a lot of experience with thread programming, none at all in
.Net really.

-Kelly

________________________________

From: [email protected]
[mailto:[email protected]] On Behalf Of Phlip
Sent: Tuesday, October 17, 2006 8:31 AM
To: [email protected]
Cc: [email protected]
Subject: [TFUI] Re: [TDD] Testing Dialogs 

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.





E-Mail messages may contain viruses, worms, or other malicious code. By reading the message and opening any attachments, the recipient accepts full responsibility for taking protective action against such code. Sender is not liable for any loss or damage arising from this message.

The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee(s). Access to this e-mail by anyone else is unauthorized.



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/