Automated tests for Java Swing GUIs [closed]
Solution 1:
Recently I came across FEST which seemed promising, except that the developer announced in 2012 that development would not continue.
AssertJ is a fork of FEST that is working very well for me. It is actively maintained (at time of writing), supports Java 8, has assertions for a few popular libraries such as Guava and Joda Time, and is very well documented. It is also free and open.
Solution 2:
I'm currently using FEST. It works with JUnit and will also take screenshots of failed tests.
It has default component hunting methods which look for the name of the component being tested (which need to be set manually), but you can also generate the testers for a given component by passing it the component.
Solution 3:
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.
Solution 4:
We are considering jemmy to automate some of the GUI testing. Looks promising.