Overview
JavaFX Unit Test base class for creating declarative, fluent, behavior-driven tests. Tests can be run individually by using the perform() method, or executed in larger suites by using a classpath traversing test runner (in-progress).
Here is an example of a simple test:
import org.jfxtras.test.Expect.*;
Test {
say: "Sequences.max should return the maximum value"
do: function() {Sequences.max([3, -1, 4, 0])}
expect: equalTo(4)
}.perform();
For more information about writing tests, please refer to the test examples in the JavaFX source code, or see my blog: http://steveonjava.wordpress.com/
Variable Summary
| access | name | type | Can Read | Can Init | Can Write | Default Value | description |
|---|---|---|---|---|---|---|---|
| public-init | assume | Assumption[] | ![]() | ![]() |
Conditions which must be met for this test to be run.
Conditions which must be met for this test to be run. This is particularly useful for parameterized testing where a large set of tests are setup, but only a limited set are valid scenarios. |
||
| public-init | cleanup | function():Void | ![]() | ![]() |
Cleanup function called after the test execution has completed. |
||
| public-init | do | function():Object | ![]() | ![]() |
Main execution block of the unit test.
Main execution block of the unit test. This should perform whatever test steps are required, and return a value that can be checked by the expect clause. Any exceptions thrown in this block will be counted towards a test failure unless they are defined in expectException. |
||
| public-init | expect | Expectation[] | ![]() | ![]() |
The main form of declarative assertions, this is a list of Expectations that if not true will fail the test.
The main form of declarative assertions, this is a list of Expectations that if not true will fail the test. For a full list of built-in expectations, see Expect. |
||
| public-init | expectException | FXClassType | ![]() | ![]() |
For tests that are designed to test failure conditions, this can be set to the type of the expected exception.
For tests that are designed to test failure conditions, this can be set to the type of the expected exception. As a convenience, all built-in exceptions inherit org.jfxtras.lang.JFXObject#getJFXClass() so there is no reflection call required. |
||
| public-init | say | String | ![]() | ![]() |
Verbal requirement for what this test should accomplish.
Verbal requirement for what this test should accomplish. For nested tests this will be concatenated with whatever the enclosing test says. |
||
| public-init | test | Test[] | ![]() | ![]() |
A list of subtests that will be run after this test, but before cleanup.
A list of subtests that will be run after this test, but before cleanup. A common usage of this is to group related tests with an outer test that has no expectations. In this case the outer test will not get counted towards the results. |
Inherited Variables
Function Summary
- public perform() : Test

