JFTex is a library for testing JavaFX applications, based on TestFX.
There are a lot of useful features, like:
Test without direct input simulation
It means that you can run the Test without mouse is moving or focus must have a JFX Node in pane to test. All values are inserted direct from code into the component. After all you can check your background model or the behavior of your pane components.
Extended Matcher for Assertions
There is an extended matcher to run better assertions in test. So you can test on selected items in selectable components, list sizes, list content and special states for chekcable components
Test Pane
Insert your pane and background model into this pane to test manually. So you can do actions on your pane to test and show model changes in a property based live view. Don't forget to call
updateModelView()
, if pane view model has changed.
You can get the library from maven central repo:
Maven
<dependency> <groupId>com.github.kleinerhacker</groupId> <artifactId>jftex</artifactId> <version>3.0.0</version> </dependency>
Gradle
compile group: 'com.github.kleinerhacker', name: 'jftex', version: '3.0.0'
To start you must extends your test class from ExtendedApplicationTest
to use directly input without input device simulation. To use extended assertion use class ExtendedMatchers
in JUnit test functions.
To use the test pane create a class in test folder and create a main method with extension to Apllication
of JavaFX framework. Launch the application and put TestPane
with your own pane to test and its background model into the scene. Now you can run the test app to run a manually JavaFX UI test.
Please note that the Test Pane based on MVVM-FX so you get a test dependency to a weld container implementation.