Testing Swing GUIs

B

Berlin Brown

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?
 
T

Thomas Weidenfeller

Berlin said:
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?

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
 
R

Ramza Brown

Thomas said:
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

These look interesting.
 
T

Thomas Hawtin

Berlin said:
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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top