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.
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.
how do you figure out the coordinates to do a button click or a text entry? Let
me guess... java.awt.Container.getLocationOnScreen() ?
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
use jython and Robot to record and playback GUI tests. It
better when jython and Robot are running in the same jvm as the
being tested. Then jython can examine the awt component
can do higher level operations than moving the mouse and
clicks and keystrokes.
I know I am
resurrecting an old thread, but I didn't see any more info about
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
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.
Cherney | Motorola
Software Engineer |