Giter Club home page Giter Club logo

testfx's Introduction

TestFX

Travis CI AppVeyor Build Status Bintray JCenter Maven Central Chat on Gitter

Simple and clean testing for JavaFX.

Status

Version 4 is in alpha phase. Release notes are listed in CHANGES.md and latest documentation is only available via gradle javadoc.

Features

  • A fluent and clean API.
  • Flexible setup and cleanup of JavaFX test fixtures.
  • Simple robots to simulate user interactions.
  • Rich collection of matchers to verify expected states.

Support for:

  • Java 8 features and JavaFX 8 controls.
  • JUnit testing framework and Hamcrest matchers.
  • Precise screenshots of failed tests.
  • Headless testing using Monocle.

Example

public class DesktopPaneTest extends ApplicationTest {
    @Override
    public void start(Stage stage) {
        Scene scene = new Scene(new DesktopPane(), 800, 600);
        stage.setScene(scene);
        stage.show();
    }

    @Test
    public void should_drag_file_into_trashcan() {
        // given:
        rightClickOn("#desktop").moveTo("New").clickOn("Text Document");
        write("myTextfile.txt").push(ENTER);

        // when:
        drag(".file").dropTo("#trash-can");

        // then:
        verifyThat("#desktop", hasChildren(0, ".file"));
    }
}

Gradle and Maven

Gradle build.gradle with testfx-core and testfx-junit from Bintray's JCenter (at https://jcenter.bintray.com/):

repositories {
    jcenter()
}

dependencies {
    testCompile "org.testfx:testfx-core:4.0.+"
    testCompile "org.testfx:testfx-junit:4.0.+"
}

Gradle build.gradle with testfx-core, testfx-legacy and a different junit version from Maven Central repository (at https://repo1.maven.org/maven2/).

repositories {
    mavenCentral()
}

dependencies {
    testCompile "junit:junit:4.10"
    testCompile "org.testfx:testfx-core:4.0.+"
    testCompile "org.testfx:testfx-legacy:4.0.+", {
        exclude group: "junit", module: "junit"
    }
}

Gradle build.gradle with testfx-core (SNAPSHOT) from Sonatype Snapshots repository (at https://oss.sonatype.org/content/repositories/snapshots/).

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
    testCompile "junit:junit:4.12"
    testCompile "org.testfx:testfx-core:4.0.0-SNAPSHOT"
}

Maven pom.xml with testfx-core from Maven Central repository (at https://repo1.maven.org/maven2/).

<repositories>
    <repository>
        <id>maven-central-repo</id>
        <url>http://repo1.maven.org/maven2</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.testfx</groupId>
        <artifactId>testfx-core</artifactId>
        <version>4.0.1-alpha</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.testfx</groupId>
        <artifactId>testfx-junit</artifactId>
        <version>4.0.1-alpha</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Maven pom.xml with testfx-core (SNAPSHOT) from Sonatype Snapshots repository (at https://oss.sonatype.org/content/repositories/snapshots/).

<repositories>
    <repository>
        <id>maven-central-repo</id>
        <url>http://repo1.maven.org/maven2</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>sonatype-snapshots-repo</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
       </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.testfx</groupId>
        <artifactId>testfx-core</artifactId>
        <version>4.0.0-SNAPSHOT</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Documentation

Motivation

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 (video).

Similar Frameworks

  • Jemmy, by the Oracle SQE team.
  • Automaton, a new testing framework that supports JavaFX as well as Swing.
  • MarvinFX, test support for JavaFX Propertys.

Mailing List

Head over to [email protected] for discussions, questions and announcements.

Credits

TestFX was initially created by @dainnilsson and @minisu as a part of LoadUI in 2012. Today, it is being extended and maintained by @hastebrot, @Philipp91, @minisu and the other contributors.

License

Copyright 2013-2014 SmartBear Software
Copyright 2014-2015 The TestFX Contributors

Licensed under the EUPL, Version 1.1 or - as soon they will be approved by the
European Commission - subsequent versions of the EUPL (the "Licence"); You may
not use this work except in compliance with the Licence.

You may obtain a copy of the Licence at:
http://ec.europa.eu/idabc/eupl

Unless required by applicable law or agreed to in writing, software distributed
under the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the Licence for the
specific language governing permissions and limitations under the Licence.

testfx's People

Contributors

aalmiray avatar bitdeli-chef avatar brcolow avatar cguckes avatar feldoh avatar hastebrot avatar joachimprinzbach avatar johnzeringue avatar jordanmartinez avatar jotomo avatar lgringo avatar minisu avatar naimdjon avatar philipp91 avatar rladstaetter avatar sergei-ivanov avatar simy4 avatar svenruppert avatar torakiki avatar waffle-iron avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.