What are some ways to unit test a GUI application. For example, I have
an application that is driven by the interface, meaning all the logic
is in the widgets. I am not used to GUI development. The only way I
can think of testing the system is by looking at it and seeing if
everything is where it is supposed to be.
What are approaches out there?
Thomas Weidenfeller - 19 Jul 2005 14:28 GMT
Berlin Brown wrote:
> What are some ways to unit test a GUI application. For example, I have
> an application that is driven by the interface, meaning all the logic
[quoted text clipped - 3 lines]
>
> What are approaches out there?
Automatic GUI testing is rather hard. Record/playback tools just bring
you to a certain point, and many fail if you do slight adjustments in
the GUI. Meaning that you have to record a new test case after a small
change. This can become very frustrating, particular if you have complex
test cases. Plan for a lot of time going into this.
The tools usually center around java.awt.Robot. If you feel adventurous,
you can run your own, based on that class (not recommended). Other tools
work still below the visible GUI and e.g. feed the event queue.
The following are free tools which I am aware of (I have no in-depth
experience with any of these):
http://marathonman.sourceforge.net/
http://jemmy.netbeans.org/
http://abbot.sourceforge.net/
http://jfcunit.sourceforge.net/
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Ramza Brown - 19 Jul 2005 14:54 GMT
> Berlin Brown wrote:
>
[quoted text clipped - 25 lines]
>
> /Thomas
These look interesting.
Ramza Brown - 19 Jul 2005 14:57 GMT
>> Berlin Brown wrote:
>>
[quoted text clipped - 28 lines]
>
> These look interesting.
Thomas Hawtin - 19 Jul 2005 15:49 GMT
Berlin Brown wrote:
> What are some ways to unit test a GUI application. For example, I have
> an application that is driven by the interface, meaning all the logic
[quoted text clipped - 3 lines]
>
> What are approaches out there?
While automated GUI testing tools are useful, I think it is useful to
separate out the widget code into the thinest possible layer. The bulk
of your code will then be much easier to test. You'll also end up with
higher quality code.
Tom Hawtin

Signature
Unemployed English Java programmer