View Full Version : Simulate Action Event or button pushed
sarahsnathan
10-10-2002, 08:40 AM
I am doing unit testing for a gui - white box unfortunately, and i was wondering if anyone knows of code that is hardcoded to push a button in the gui.
I know it is possible but not sure how.
anyhelp would be greatly appreciated thanks
Strike
10-10-2002, 09:05 AM
Assuming you are using a JButton, simply call the "doClick()" method on it. Details here (http://java.sun.com/j2se/1.4/docs/api/javax/swing/AbstractButton.html#doClick()).
sicarius
10-12-2002, 09:28 PM
You could also check out the Robot class in the API. Not sure that is what your looking for but you never know.
stuka
10-14-2002, 06:54 PM
There's an interesting article over on objectmentor.com on unit testing and dialog box-style GUIs. It may not apply to you, but it's worth a read. It's called "The Humble Dialog Box" or something like that.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.