UISpec4J is an Open Source functional and/or unit testing library for Swing-based Java applications, built on top of the JUnit test harness.
If you are writing a Swing application, you will appreciate UISpec4J above all for its simplicity: UISpec4Js APIs are designed to hide as much as possible the complexity of Swing, resulting in easy to write and easy to read test scripts. This is especially true when comparing UISpec4J tests with those produced using Swing or low-level, event-based testing libraries.
- API designed for readability: our APIs are designed to
make the test scripts as close as possible to human-readable text. We avoid
complex language construct such as casts or anonymous classes, and try to
use data structures well suited to the data to be checked (indented ASCII
for checking the hierarchical contents of a Tree, two-dimensional arrays for
checking the contents of a Table, etc.).
- Smart component search: the framework makes it possible
to find UI components without requiring that the developers assign names to
all of them. For instance, it is possible to find heavyweight components
such as trees or tables without specifying any name, and it is possible to
retrieve components such as buttons or check boxes using their displayed
- Rely on displayed information only: the library checks
the labels displayed by components such as tables, trees or lists,
instead of the string representation of their internal model data. To
achieve this, the UI components check the values shown by the Swing
- Invisible execution: the framework does not require that
the GUI be visible when the tests are being run. This is useful for instance
when running the tests suite on a "headless" integration server.
- No modifications needed in production code - you do not
need to ship UISpec4Js JAR with your deliverable product, and GUI tests can
be written without needing to adapt your application design.
- Extensibility: you can add your own custom UISpec4J
components to the library, for instance to support third-party Swing
- Smart color specification: colors are specified either
with a string representation (in hexadecimal format, as in HTML), or with a
human-readable name which is an approximation of the color - for instance,
AA1100 is still "red".