Dienstag, 4. Februar 2014

TestFX a must for jUnit Tests inside JavaFX environments!

You have written jUnit Tests for JavaFX applications? 
You want to simulate user interactions?

If you are starting from scratch this will be a long task.
But the Team from TestFX is working on a solution.
TestFX (https://github.com/SmartBear/TestFX) is an OpenSource framework from Henrik Olsson (SmartBear) with the goal to be an easy-to-use framework for testing JavaFX.

This framework is ready for Java8 and supports JavaFX 2.
With this you are able to test featured JavaFX based GUIs.

No License needed, no costs, complete OpenSource and extensible.

The fluent and clean API is simple to use for the interaction with the controls. No special wrapper must be implemented, no boilerplate code is needed to test a simple control. Extend the jUnit Test-class and create an instance of your JavaFX control.

That´s all you need. After this you are able to interact directly with the instance you created.
TestFX will give you a lot of service methods to interact and verify the behavior of the tested control.
And, if something goes wrong, you will get an screenshot of the failed test.

One of the really big advantages is the easy possibility to extend TestFX by yourself. The framework is clean and well structured.
The support for Hamcrest Matchers and Lambdas will give you all you need to build complex tests.

There is only one more thing....
...  we are working on the CDI support for TestFX.

stay tuned and happy coding.