XP
BrainLoaf.com's take on Extreme Programming











Subscribe to "XP" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.
 

 

Monday, October 7, 2002
 

My question posed to the XP Yahoo Group: Can some people share their experiences with testing tools for Swing. Currently we do not automate acceptance tests as they pertain to UI. I want to get this moving. We already use JUnit and are learning Cactus for our web apps.

What are people using for Swing UI's?

Mike

The responses:

Alex Chaffee
I use test-package-accessible accessors and/or mock objects and/or mock event handlers to test my Swing objects.

CalculatorPanel p = new CalculatorPanel()
p.getFirstOperandTextField().setText("2");
p.getSecondOperandTextField().setText("5");
p.getAddButton().doClick();
assertEquals("7", p.getResultTextField().getText());

There's also JFCUnit which reportedly does some AWT magic to intercept events and grab all the components by name, which is good to test GUIs that were not designed with accessors for the interesting bits. See http://jfcunit.sourceforge.net/ and http://jfcunit.sourceforge.net/loginscreenexample.html

Matthew Pekar
For acceptance tests, I use my own utility, Pounder, which is available on SourceForge. There are two other similar projects, Abbot and qftestJUI. qftestJUI is commercial. Rational I believe has something also.

http://pounder.sourceforge.net/
http://abbot.sourceforge.net/
http://www.qfs.de/en/qftestJUI/

Pounder works by recording user input on a given test class and saving it to a script. The user can add simple assertions (window showing, text equals, etc.), or have the developer examine the results of the test in source (was my data entered in the database, was the file written, etc.)

Documentation of acceptance tests can be done with Pounder (depending on what one considers documentation). For example, the user could record a script, which he then comments: "After this script is played, so and so should be present in the database". He gives it to the developers, who then write the database check in Java. The user has still constructed the test, but there is a portion that is not very practical for him to implement. A comment describing the test is also nice to have in case it needs to be rerecorded in the future.

The downside of Pounder is that a test can't be constructed till a GUI skeleton is in place. Given how easy it is to use, I don't consider this much of a problem. The bottom line is the customer gets their tests.

Dave Astels
JFCUnit is ok, but you have overhead code to add to your tests, and you have to extend a special TestCase.

Have a look at Jemmy as well, much more powerful & cleaner: http://jemmy.netbeans.org/

mlroyle
There is a SourceForge project called Marathon (http://marathonman.sourceforge.net). It is based on JFCUnit and handles a lot of issues that you raised. It will record user activities and store them in an XML file that can either be run from the commandline (or build script) or from the recording gui.
12:48:31 PM    



Click here to visit the Radio UserLand website. © Copyright 2007 Mike Rogers.
Last update: 4/27/07; 11:46:36 AM.
This theme is based on the SoundWaves (blue) Manila theme.
October 2002
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Sep   Nov