Folks,

I'm attempting to use this package in order to automate QA testing. My app
makes extensive use of a JTree.

I am extending it with a class which implements AWTEventListener. When the
user starts "recording," all AWTEvents are queued. When the user hits
"playback," they are dispatched via calls to the Robot.

It seems to work in playback, the only problem is that mouse clicked,
pressed and released event don't seem to happen right away. The mouse moved
events are fine; it moves around the screen to all the locations visited
while recording.

But the button events seem to be delayed, so that the wrong tree elements
are clicked, because by the time the click is dispatched, the mouse is over
a new component.

I have tried calls to Robot.waitForIdle() and autoWaitForIdle(), but they
specify that they cannot be called directly from the event dispatching
thread, and I am on that thread. Spinning a new one seems pointless. I have
also tried Component.dispatchEvent(AWTEvent) with the recorded event, but
this seems to do nothing at all.

Anyone have any ideas?

Another question that arises from this: some events on my JTree trigger
network/database IO which is inherently unpredictable. This makes the task
of playback much more difficult. If the environment in which a test "script"
was generated had fast IO responses, and the playback env has slow
responses, it won't work. I am logging the time in between events, and play
the times back as well, but that still reflects the recording environment.
Is there a way to wait for an event to complete without complicated
synchronization, which would entangle the Robot into my application?

Thanks for any ideas.

Jon

Postlogue: JavaSoft has done such a nice job on the API, don't you wish they
just had the foresight to document it properly? I mean, they wrote javadoc
themselves; they know all they have to do is use meaningful comments. 
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to