Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

FEST's Swing module is a Java library that provides a fluent interface for functional Swing GUI testing. This library provides an easy-to-use API that makes creation and maintenance of GUI tests easy.

Why do we need to test GUIs?

Testing GUIs can make the entire system safer and more robust. Any GUI, even one providing only the simplest capabilities, likely encloses some level of complexity. Any complexity in software must be tested because code without tests is a potential source of bugs. A well-tested application has a greater chance of success.

GUI testing is also essential during application maintenance. During this phase, code might be refactored frequently to improve design, and this code often encloses great portions of the user interface. Having a solid test suite that includes GUI code can give us confidence that we are not inadvertently introducing bugs.

Reference: Test-Driven GUI Development with TestNG and Abbot by Alex Ruiz and Yvonne Wang Price (IEEE Software May/June 2007 issue)

Feature Overview

  1. Simulation of user interaction with a GUI (e.g. mouse and keyboard input, drag 'n drop)
  2. Reliable GUI component lookup (by type, by name or custom search criteria)
  3. Support for all Swing components included in the JDK
  4. Compact and powerful API for creation and maintenance of functional GUI tests
  5. Support for regular expression matching
  6. Supports Applet testing
  7. Ability to embed screenshots of failed GUI tests in HTML test reports
  8. Can be used with either TestNG or JUnit
  9. Supports testing violations of Swing's threading rules
  10. Experimental Groovy Builder support (coming soon!)

FEST-Swing requires Java SE 5.0 or later.

It can be downloaded here. For Maven 2 users, details about the project's repository can be found at here.

Examples

The following example shows a test verifying that an error message is displayed if the user forgets to enter her password when trying to log in an application:

Code Block
java
java
dialog.comboBox("domain").select("Users");
dialog.textBox("username").enterText("leia.organa");
dialog.button("login").click();
dialog.optionPane().requireErrorMessage()
                   .requireMessage("Please enter your .*"); // using regular expression matching

Documentation [more]

Section
Column
width50%

Getting Started
How to install and begin using FEST-Swing.

Column
width50%

Input Simulation
Input simulation using the mouse and keyboard, drag 'n drop actions, etc.

Section
Column
width50%

Basics
Configuration, cell renderers and writers, etc.

Column
width50%

Running Tests
How to run GUI tests without disrupting your desktop, interrupting GUI tests, etc.

Section
Column
width50%

Swing's Event Dispatch Thread (EDT)
Verifying violations in EDT access and how to prevent them.

Column
width50%

Continuous Integration
Running and troubleshooting FEST tests in Continuous Integration servers in different environments.

Section
Column
width50%

Component Lookup
Looking up GUI components to test.

Column
width50%

Troubleshooting GUI Test Failures
How to figure out what went wrong when GUI tests fail.

Section
Column
width50%

Launching
Launching and testing applications and applets.

Column

Advanced Features
Component formatters, platform-specific behaviour, extending FEST-Swing, assertions with timeouts, etc.