Java friendly DSL for defining TestFX tests

Related tags

JSON testfx-dsl
Overview

TestFX-DSL

EUPL 1.1 download


TestFX-DSL aims to bring DSL capabilities on top of TestFX. Inspired by Geb, this DSL enables a fluent interface design on top of the facilities exposed by TestFX.

Instead of writing code such as

clickOn("#showSettingsButton");
JFXDrawer settingsPanel = lookup("#drawer").query();
waitUntil(settingsPanel, isShown(), defaultWaitTimeout());
verifyThat("#username", hasText(defaultUsernameValue));
clickOn("#username").eraseText(defaultUsernameValue.length());
clickOn("#username").write(usernameValue);
verifyThat("#username", hasText(usernameValue));

write it like this

$("#showSettingsButton")
    .click()
.$$("#drawer")
    .waitUntil(isShown(), defaultWaitTimeout())
.$$("#username")
    .verifyThat(hasText(defaultUsernameValue))
    .click()
    .eraseText(defaultUsernameValue.length())
    .write(usernameValue)
    .verifyThat(hasText(usernameValue));

The DSL allows you to chain method calls and remember the last NodeQuery made. It’s easy to get started, just add the following import statement to your test case:

import static org.kordamp.testfx.QueryChain.$;

Installing

You can get the latest version of TestFX-DSL directly from Bintray’s JCenter repository.

Gradle
testCompile 'org.kordamp.testfx:testfx-dsl:0.1.0
Maven
<dependency>
    <groupId>org.kordamp.testfxgroupId>
    <artifactId>testfx-dslartifactId>
    <artifactId>0.1.0artifactId>
    <scope>testscope>
dependency>

<repositories>
    <repository>
        <id>jcenterid>
        <url>http://jcenter.bintray.com/url>
    repository>
repositories>

Building

You must meet the following requirements:

  • JDK8u60 as a minimum

  • Gradle 2.14

You may used the included gradle wrapper script if you don’t have gradle installed.

Installing Gradle

Manual
  1. Download Gradle from http://gradle.org/downloads

  2. Unzip the file into a directory without spaces (recommended).

  3. Create a GRADLE_HOME environment variable that points to this directory.

  4. Adjust your PATH environment variable to include $GRADLE_HOME/bin (%GRADLE_HOME%\bin on Windows).

  5. Test your setup by invoking gradle --version.

SDKMAN
  1. Follow the instructions found at http://sdkman.io/ to install SDKMAN.

  2. You need a POSIX environment if running Windows. We recommend using Babun Shell (http://babun.github.io/)

  3. Once SDKMAN is installed invoke sdk install gradle 2.14.

  4. Test your setup by invoking gradle --version.

Gdub

GDub is a wrapper script that facilitates invoking gradle tasks anywhere within a Gradle project. It’s smart enough to use the gradle wrapper if available or your global gradle command. This is an optional download.

  1. Follow the instructions found at https://github.com/dougborg/gdub to install gdub

Next Steps

  1. Make a full build issuing gradle build.

You might also like...

Set of support modules for Java 8 datatypes (Optionals, date/time) and features (parameter names)

Overview This is a multi-module umbrella project for Jackson modules needed to support Java 8 features, especially with Jackson 2.x that only requires

Dec 23, 2022

A modern JSON library for Kotlin and Java.

Moshi Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects: String json = ...; Moshi moshi = new Mos

Dec 31, 2022

A fast JSON parser/generator for Java.

A fast JSON parser/generator for Java.

fastjson Fastjson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON str

Dec 31, 2022

JSON to JSON transformation library written in Java.

Jolt JSON to JSON transformation library written in Java where the "specification" for the transform is itself a JSON document. Useful For Transformin

Dec 30, 2022

Java JsonPath implementation

Jayway JsonPath A Java DSL for reading JSON documents. Jayway JsonPath is a Java port of Stefan Goessner JsonPath implementation. News 10 Dec 2020 - R

Jan 4, 2023

A streaming JsonPath processor in Java

JsonSurfer - Let's surf on Json! Why JsonSurfer Streaming No need to deserialize entire json into memory. JsonPath Selectively extract json data by th

Dec 12, 2022

Sawmill is a JSON transformation Java library

Sawmill is a JSON transformation Java library

Update: June 25, 2020 The 2.0 release of Sawmill introduces a breaking change to the GeoIpProcessor to comply with the updated license of the MaxMind

Jan 1, 2023

Genson a fast & modular Java Json library

Genson Genson is a complete json - java conversion library, providing full databinding, streaming and much more. Gensons main strengths? Easy to use

Jan 3, 2023

A reference implementation of a JSON package in Java.

JSON in Java [package org.json] Click here if you just want the latest release jar file. Overview JSON is a light-weight language-independent data int

Jan 6, 2023
Owner
Andres Almiray
JSR377 Spec lead, Java Champion, Hackergarten. https://www.patreon.com/aalmiray
Andres Almiray
JSON Library for Java with a focus on providing a clean DSL

JSON Library for Java with a focus on providing a clean DSL

Vaishnav Anil 0 Jul 11, 2022
MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJO to JSON in a declarative way.

MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJ

Andrei Ciobanu 59 Sep 17, 2022
Vert.x jOOQ DSL

jOOQ.x - Vertx jOOQ DSL jooqx leverages the power of typesafe SQL from jOOQ DSL and running on SQL connection in a reactive and non-blocking of SQL dr

zero88 18 Nov 16, 2022
Compare JSON in your Unit Tests

JsonUnit JsonUnit is a library that simplifies JSON comparison in tests. APIs AssertJ integration Hamcrest matchers Spring MVC assertions Spring WebTe

Lukáš Křečan 719 Dec 29, 2022
Write JSON unit tests in less code. Great for testing REST interfaces.

JSONassert Write JSON unit tests in less code. Great for testing REST interfaces. Summary Write JSON tests as if you are comparing a string. Under the

Skyscreamer 899 Dec 29, 2022
Convert Java to JSON. Convert JSON to Java. Pretty print JSON. Java JSON serializer.

json-io Perfect Java serialization to and from JSON format (available on Maven Central). To include in your project: <dependency> <groupId>com.cedar

John DeRegnaucourt 303 Dec 30, 2022
A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Google 21.7k Jan 8, 2023
A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back, with a transparent support of any kind of self-references and with a full Java 9 compatibility.

Andrey Mogilev 9 Dec 30, 2021
A simple java JSON deserializer that can convert a JSON into a java object in an easy way

JSavON A simple java JSON deserializer that can convert a JSON into a java object in an easy way. This library also provide a strong object convertion

null 0 Mar 18, 2022
Java with functions is a small java tools and utils library.

Java with functions is a small java tools and utils library.

null 4 Oct 14, 2022