From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26070 invoked by alias); 25 Sep 2007 19:24:38 -0000 Received: (qmail 26062 invoked by uid 22791); 25 Sep 2007 19:24:37 -0000 X-Spam-Check-By: sourceware.org Received: from brmea-mail-4.Sun.COM (HELO brmea-mail-4.sun.com) (192.18.98.36) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 25 Sep 2007 19:24:29 +0000 Received: from fe-amer-09.sun.com ([192.18.109.79]) by brmea-mail-4.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l8PJORol008156 for ; Tue, 25 Sep 2007 19:24:27 GMT Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JOX00A01UOAZA00@mail-amer.sun.com> (original mail from David.Herron@Sun.COM) for mauve-discuss@sources.redhat.com; Tue, 25 Sep 2007 13:24:27 -0600 (MDT) Received: from [129.145.161.155] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JOX00DNVV8QIR60@mail-amer.sun.com>; Tue, 25 Sep 2007 13:24:26 -0600 (MDT) Date: Tue, 25 Sep 2007 19:24:00 -0000 From: David Herron Subject: Re: Tweaking default java.awt.Robot settings In-reply-to: <46F95466.7070700@redhat.com> To: Thomas Fitzsimmons Cc: =?UTF-8?B?U3RldmUgTWNLYXnimIQ=?= , mauve-discuss@sources.redhat.com Message-id: <46F960FC.2070608@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 8BIT References: <4f2ee4520709241331o1a77379cudffb314dc1622914@mail.gmail.com> <46F8238C.8020606@sun.com> <46F95466.7070700@redhat.com> User-Agent: Thunderbird 1.5.0.13 (X11/20070824) X-IsSubscribed: yes Mailing-List: contact mauve-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00032.txt.bz2 Thomas Fitzsimmons wrote: > David Herron wrote: >> Steve McKay☄ wrote: > >> Robot does not add events to EventQueue but it requests the OS to >> synthesize an OS-level event. > > How has Sun implemented GUI testing? When I was considering how to do > GUI testing in Mauve, I considered the EventQueue-posting approach, > but decided on a Robot-based approach instead. I thought Robot tests > would be more realistic, testing things like window manager > interactions and the native peers' event processing code. I knew > Robot tests would be more fragile, but I assumed that we could > compensate for the fragility: e.g. fix timing problems by introducing > delays, as Steve has proposed. Did Sun experiment with Robot tests, > then abandon them? If Robot can't be counted on to do something > within some time delay, is it also useless in non-test applications? > > I've always wondered how the TCK certified AWT and Swing > functionality. Does it use EventQueue-posting? > > Tom > We make heavy use of Robot. I haven't been writing tests for a long time so I don't know for sure the techniques used by the team. Sometimes I worry about whether they are using sleep's and the like to synchronize validation that a desired event has occurred. If you click on something, move a mouse pointer, type a key.. there's a listener fired in 99% of the cases you would be testing. So I think it'd be more reliable to synchronize the validation based on when the listener fires. Unfortunately that can turn into difficult coding to ensure the test doesn't deadlock or otherwise go off into the weeds because cross-thread notification of the listener firing didn't happen in the right order. I'm sure it's much simpler to code up a simple sleep and 99% of the time the system will be fast enough responding to post the listener callback within a couple milliseconds. I believe that the TCK, where it has automated tests, uses Robot as well. I don't know that for sure since I've not been involved with writing the TCK's, and that's a different team than mine. The TCK also has manual tests. And the reason you give for using Robot is exactly the reasoning we have. Since we're testing AWT/Swing a we have to make sure to test AWT and the peers. Stuffing events in the EventQueue doesn't test the native parts of AWT including the peers. That was the rationale for putting Robot into the platform in the first place (that and to support writing freestanding demo apps), and it's true today. - David Herron P.S. there's a summary here: http://wiki.java.net/bin/view/Javapedia/TestingGUIApplications of GUI testing methods.. it's been added to over several years and has some good pointers.