Re: [TFUI] Is test driven UI development conceptually different?

Timothy Wall <[email protected]>
Newsgroups gmane.comp.programming.test-first-user-interfaces
Message-ID <[email protected]>
On Jul 28, 2004, at 10:25 PM, Phlip wrote:

>  New question:
>
>  Suppose this were a Jemmy test case:
>
>    public void testIt ()
>    {
>      // Turn off Jemmy output.
>     
>      JemmyProperties.setCurrentOutput
>  (TestOut.getNullOutput ());
>     
>      // Shorten timeouts so things fail quicker.
>     
>      Timeouts.setDefault
>  ("FrameWaiter.WaitFrameTimeout", 5000);
>      Timeouts.setDefault
>  ("DialogWaiter.WaitDialogTimeout", 5000);
>      Timeouts.setDefault
>  ("ComponentOperator.WaitComponentTimeout", 5000);
>     
>      // Start the application under test.
>     
>      HelloWorld.main (new String[0]);
>     
>      JFrameOperator frame = new JFrameOperator ("Hello,
>  World!");
>     
>      // Find 1st (0th) JTextField in frame.
>     
>      JTextFieldOperator textfield = new
>  JTextFieldOperator (frame, 0);
>      assertTrue ("textfield is enabled",
>  textfield.isEnabled ());
>      assertTrue ("textfield is editable",
>  textfield.isEditable ());
>  ...
>  }
>
>  It paints the screen as it goes.
>
>  I don't know enough Swing to answer my favorite
>  question: How to introduce a temporary line to that
>  test which blocks the event queue until the user
>  clicks the close button on the testee window.

Do you want to block the event queue or block test execution?  I assume  
the latter, b/c blocking the event queue would mean you could never  
process the close button...

JOptionPane.showMessageDialog() may be invoked from within the test  
case context; it effectively suspends the current event queue and  
starts a new one for the dialog.

Or if you want to suspend test execution until the frame referred to by  
the JFrameOperator is closed, you could do

class Flag { boolean flag; }
final Flag flag = new Flag();
frame.addWindowListener(new WindowAdapter() {
     public void windowClosing(WindowEvent e) {
         flag.flag = true;
         frame.removeWindowListener(this);
     }
});

while (!flag.flag)
     Thread.sleep(100);

This is actually useful for tests which require some sort of manual  
inspection that can't be readily codified.  Throw up a pass/fail  
dialog, and you get semi-automation of the tests with automatically  
recorded results of human observation.  (for single-threaded  
environments like VB, it's sometimes the only reasonable way you can do  
automated GUI behavior validation)

>  (Note
>  the test fixtures might configure the close button to
>  resume the test, not destroy the window.)
>
>
>  =====
>  Phlip
>     
> http://industrialxp.org/community/bin/view/Main/ 
> TestFirstUserInterfaces
>
>
>             
>  __________________________________
>  Do you Yahoo!?
>  Yahoo! Mail - You care about security. So do we.
> http://promotions.yahoo.com/new_mail
>
>
> To unsubscribe, email:
>  TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
>
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
> <image.tiff>
> <image.tiff>
>
> Yahoo! Groups Links
>
> 	• 	To visit your group on the web, go to:
> http://groups.yahoo.com/group/TestFirstUserInterfaces/
>  
> 	• 	 To unsubscribe from this group, send an email to:
> TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
>  
> 	• 	 Your use of Yahoo! Groups is subject to the Yahoo! Terms of  
> Service.
>
>  


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

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/

<*> 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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.