See: Description
| Interface | Description |
|---|---|
| ComponentContainerFixture |
Looks up AWT or Swing
Components in a Container. |
| EditableComponentFixture<S> |
Verifies the state of editable
Components. |
| FrameLikeFixture<S> |
Supports functional testing of frame-like components (not necessarily subclasses of
java.awt.Frame). |
| ItemFixture<S> |
Supports functional testing of single items inside
JComponents (e.g. |
| ItemGroupFixture<S> |
Supports functional testing of
Components that contains or display a group of items. |
| JComponentFixture<S> |
Supports functional testing of
JComponents. |
| JPopupMenuInvokerFixture |
Simulates user input on
JComponents capable of invoking JPopupMenus. |
| JTreeNodeFixture<S> |
Supports functional testing of single nodes in
JTrees |
| MouseInputSimulationFixture<S> |
Simulates mouse input on an AWT or Swing
Component. |
| TextDisplayFixture<S> |
Supports functional testing of
Components that display text. |
| TextInputFixture<S> |
Simulates user events on
Components that accept text input from the user. |
| WindowLikeContainerFixture<S> |
Supports functional testing of window-like containers (not necessarily subclasses of
Window). |
| Class | Description |
|---|---|
| AbstractButtonFixture<S,T extends AbstractButton> |
Supports functional testing of
AbstractButtons. |
| AbstractComponentFixture<S,C extends Component,D extends ComponentDriver> |
Supports functional testing of AWT and Swing
Components. |
| AbstractContainerFixture<S,C extends Container,D extends ComponentDriver> |
Looks up AWT or Swing
Components contained in a Container. |
| AbstractJComponentFixture<S,T extends JComponent,D extends JComponentDriver> |
Supports functional testing of
JComponents. |
| AbstractJPopupMenuInvokerFixture<S,T extends JComponent,D extends JComponentDriver> |
Supports functional testing of
JComponents capable of invoking JPopupMenus. |
| AbstractSwingContainerFixture<S,C extends JComponent,D extends JComponentDriver> |
Supports functional testing of Swing
Containers. |
| AbstractTwoStateButtonFixture<S,T extends AbstractButton> |
Supports functional testing of
AbstractButtons that have 2 states ("checked" and "unchecked.") |
| AbstractWindowFixture<S,C extends Window,D extends WindowDriver> |
Supports functional testing of
Window. |
| ColorFixture |
Verifies the state of
Colors. |
| ComponentFixtureExtension<C extends Component,F extends AbstractComponentFixture<?,C,?>> |
An "extension method" for implementations of
AbstractContainerFixture. |
| Containers |
Utility methods related to
Containers. |
| DialogFixture |
Supports functional testing of
Dialogs. |
| FontFixture |
Verifies the state of
Fonts. |
| FrameFixture |
Supports functional testing of
Frames. |
| JButtonFixture |
Supports functional testing of
JButtons. |
| JCheckBoxFixture |
Supports functional testing of
JCheckBoxes. |
| JComboBoxFixture |
Supports functional testing of
JComboBoxes. |
| JFileChooserFixture |
Supports functional testing of
JFileChoosers. |
| JInternalFrameFixture |
Supports functional testing of
JInternalFrames |
| JLabelFixture |
Supports functional testing of
JLabels. |
| JListFixture |
Supports functional testing of
JLists. |
| JListItemFixture |
Supports functional testing of single items in
JLists. |
| JMenuItemFixture |
Supports functional testing of
JMenuItems. |
| JOptionPaneFixture |
Supports functional testing of
JOptionPanes. |
| JPanelFixture |
Supports functional testing of
JPanels. |
| JPopupMenuFixture |
Supports functional testing of
JPopupMenus |
| JProgressBarFixture |
Supports functional testing of
JProgressBars. |
| JRadioButtonFixture |
Supports functional testing of
JRadioButtons. |
| JScrollBarFixture |
Supports functional testing of
JScrollBars. |
| JScrollPaneFixture |
Supports functional testing of
JScrollPanes. |
| JSliderFixture |
Supports functional testing of
JSliders. |
| JSpinnerFixture |
Supports functional testing of
JSpinners: |
| JSplitPaneFixture |
Supports functional testing of
JSplitPanes. |
| JTabbedPaneFixture |
Supports functional testing of
JTabbedPanes. |
| JTableCellFixture |
Supports functional testing of single cells in
JTables. |
| JTableFixture |
Supports functional testing of
JTables. |
| JTableHeaderFixture |
Supports functional testing of
JTableHeaders. |
| JTextComponentFixture |
Supports functional testing of
JTextComponents. |
| JToggleButtonFixture |
Supports functional testing of
JToggleButtons. |
| JToolBarFixture |
Supports functional testing of
JToolBars. |
| JTreeFixture |
Supports functional testing of
JTrees. |
| JTreePathFixture |
Supports functional testing of single nodes, referenced by their paths, in
JTrees. |
| JTreeRowFixture |
Supports functional testing of single nodes, referenced by their row indices, in
JTrees. |
| Enum | Description |
|---|---|
| JToolBarFixture.UnfloatConstraint |
Constraints used to unfloat a floating
JToolBars. |
Public API, source of FEST's power and flexibility. Although you can use the BasicRobot
directly, it is too low-level and requires, in our opinion, too much code. FEST fixtures can simplify creation and
maintenance of functional GUI tests by:
The following example shows how easy is to use FEST fixtures. The test verifies that an error message is displayed if the user enters her username but forgets to enter her password.
private FrameFixture window;
@Before
public void setUp() {
window = new FrameFixture(new LoginWindow());
window.show();
}
@After
public void tearDown() {
window.cleanUp();
}
@Test
public void shouldCopyTextInLabelWhenClickingButton() {
window.textBox("username").enterText("some.user");
window.button("login").click();
window.optionPane().requireErrorMessage().requireMessage("Please enter your password");
}
The test uses a FrameFixture to launch the GUI to test (LoginWindow) and find
the GUI components in such window. This is the recommended way to use FEST. We could also use individual fixtures to
simulate user events, but it would result in more code to write and maintain:
privateBasicRobotrobot; @Before public void setUp() { robot = BasicRobot.robotWithNewAwtHierarchy(); robot.showWindow(new LoginWindow()); } @After public void tearDown() { robot.cleanUp(); } @Test public void shouldCopyTextInLabelWhenClickingButton() { newJTextComponentFixture(robot, "username").enterText("some.user"); newJButtonFixture(robot, "login").click(); newJOptionPaneFixture(robot).requireErrorMessage().requireMessage("Please enter your password"); }
Note: It is very important to clean up resources used by FEST (keyboard, mouse and opened windows)
after each test; otherwise, the FEST robot will keep control of them and can make your computer pretty much unusable.
To clean up resources call the method 'cleanUp' from BasicRobot,
FrameFixture or DialogFixture.
Each fixture has the name of the GUI component it can control plus the word "Fixture" at the end. For
example, JButtonFixture can simulate user events on JButtons.
Copyright © 2014 AssertJ. All rights reserved.