views:

938

answers:

7

While we try to set up as many unit tests as time allows for our applications, I always find the amount of UI-level tests lacking. There are many options out there, but I'm not sure what would be a good place to start.

What is your preferred unit testing tool for testing Swing applications? Why do you like it?

Thanks!

A: 

try pounder : http://pounder.sourceforge.net/

zurk
+5  A: 

On our side, we use to test SWING GUI with FEST. This is an adapter on the classical swing robot, but it ease dramatically its use.

Combined with TestNG, We found it an easy way to simulate "human" actions trough the GUI.

gizmo
A: 

I had the chance to play around with QF-TEST once. It is commercial, but offers a lot of functionality. Maybe you have a look at it: http://www.qftest.de/en/index.html

Roland Schneider
+2  A: 

Consider Marathon (http://www.marathontesting.com/Home.html)--tests are written in Jython, so it's easy to write any sort of predicates based on object state.

A: 

I like Jemmy, the library written to test Netbeans.

Tom
+1  A: 

You can try to use Cucumber and Swinger for writing functional acceptance tests in plain english for Swing GUI applications. Swinger uses Netbeans' Jemmy library under the hood to drive the app.

Cucumber allows you to write tests like this:

 Scenario: Dialog manipulation
    Given the frame "SwingSet" is visible
      And the frame "SwingSet" is the container
    When I click the menu "File/About"
    Then I should see the dialog "About Swing!"
    Given the dialog "About Swing!" is the container
    When I click the button "OK"
    Then I should not see the dialog "About Swing!"

Take a look at this Swinger video demo to see it in action.

Dema
+2  A: 

If your target application has custom components, I would definitely recommend Marathon to automate your tests.

I was given the task of automating an application with several extremely complicated custom components, written in-house from the ground up. I went through a review process that lasted two months, in which I made the decision on which test tool to use, from a list of close to 30 test tools that were available, both commercial and FOSS.

It was the only test tool that was able to successfully automate our particular custom components; where IBM's Rational Functional Tester, Microfocus' TestPartner, QF-Test, Abbot & FEST failed.

I have since been able to successfully integrate the tests with Cruise Control such that they run upon completing each build of the application.

A word of warning though:
1) it is rather rough around the edges in the way it handles JTables. I got around this by writing my own proxy class for them.
2) Does not support record/replay of drag-and-drop actions yet.

bguiz
Very interesting informations. Any feedback on http://frankenstein.openqa.org/?
Pascal Thivent
Hi Pascal, unfortunately Frankenstein wasn't one of those that I did try. I looked at the presentation on the link, and I can say that it does look rather similar to Marathon in terms of proxy classes and OGNL-style assertions. Differences: Marathon doesn't appear to have inbuilt threading support or i18n support. Looks interesting.
bguiz