I saw your post on how to record the AWTEvents by registering with the DefaultToolkit. How do you record using Robot? I guess a larger concern is how to you get coordinates? What if your UI components move around some? Do you have to go through all of your tests and tweak coordinates? I guess that isn't a big deal anyway. You want to run all of your tests anyway, and you have to figure out if each failed test fails because of the test (bad coordinates or something like that) or because of the app.
Robot looked really promising, but it seemed pretty low level. I was wondering if it would be easier just to create my own AWTEvents and then post them. The problem with that is that I should give a valid source, which means I would have to go through the component hierarchy to get the source. Hmmn. It sure would be nice if I could get the source to generate that event itself, since it is supposed to do that anyway. You know, after thinking about it, maybe Robot is the easiest way of doing that.
So, how do you figure out the coordinates to do a button click or a text entry? Let me guess... java.awt.Container.getLocationOnScreen() ?
Oh, before I forget, one last question: How do you take care of the System.exit problem? If you are running jython and Robot in the same jvm and you exit and your windowClosing callback calls System.exit(), then everything closes, including your test harness. Is there a different way of closing the app, or do you control this externally by having a script/program which runs your suite of tests?
Thanks again,
-----Original Message-----
From: Jeff Emanuel [mailto:JEmanuel@lgc.com]
Sent: Monday, September 22, 2003 4:16 PM
To: 'Cherney John-CJC030'; jython-users@lists.sourceforge.net
Cc: John Schaefer
Subject: RE: [Jython-users] testing framework for GUI's

We use jython and Robot to record and playback GUI tests.  It works
better when jython and Robot are running in the same jvm as the app
being tested.  Then jython can examine the awt component hierarchy
and can do higher level operations than moving the mouse and sending
clicks and keystrokes.
-----Original Message-----
From: Cherney John-CJC030 [mailto:John.Cherney@motorola.com]
Sent: Monday, September 22, 2003 1:25 PM
To: jython-users@lists.sourceforge.net
Subject: [Jython-users] testing framework for GUI's

I know I am resurrecting an old thread, but I didn't see any more info about it...
Executive Summary: Is there a way to use jython to do automated unit tests? Answer: 2 different options, both can be done in either Java or jython. 1) Recording AWT events using a listener, and then playing the events back, or 2) using java.awt.Robot
So, has anybody tried either of these? How was the experience? Are there things I should look out for with either of these? Can anyone point me to some examples I could look at? Are there other options not mentioned here? I would love to have a way to code up my box test cases and run them automatically, and I don't want to reinvent the wheel.
John Cherney          | Motorola Inc
Software Engineer     | phone:(248)994-7713
Network Transport     |   fax:(248)324-9550
CGISS                 | pager:(888)878-1354