Easy-to-use library for testing JavaFX. TestFX provides:
- A fluent and clean API for interacting with, and verifying the behavior of, JavaFX applications.
- Supports Hamcrest Matchers and Lambda expressions.
- Screenshots of failed tests.
- Supports JavaFX 2 and JavaFX 8.
class DesktopTest extends GuiTest
{
public Parent getRootNode() {
return new Desktop()
}
@Test
public void shouldBeAbleToDragFileToTrashCan() {
// GIVEN
rightClick("#desktop").move("New").click("Text Document")
.type("myTextfile.txt").push(ENTER);
// WHEN
drag(".file").to("#trash-can");
// THEN
verifyThat("#desktop", contains(0, ".file"));
}
}
- Getting started
- Examples
- Reference
- Mouse control
- Keyboard control
- Assertions
- Waiting
- Specific controls
- Misc.
- Using TestFX with Spock.
- Conference sessions featuring TestFX: JavaZone and JavaOne.
The motivation for creating TestFX was that the existing library for testing JavaFX, Jemmy, was too verbose and unwieldy. We wanted more behavior driven tests with easy-to-read code that our tester could follow and modify on her own. Today, TestFX is used in all of the about 100 automated GUI tests in LoadUI (source code, video).
Head over to [email protected] for discussions, questions and announcements.
TestFX was initially created by @dainnilsson and @minisu as a part of LoadUI in 2012. Today, it is being extended and maintained by @minisu, @Philipp91 and the other contributors.