Reputation: 1396
I have finished writing an API for my application, and wanted to connect a GUI to it. I am programming in Java, so that's why I chose JavaFX as GUI framework. Because I like its design.
But when I started to write unit tests for JavaFX components, I was surprised that JUnit, Mockito, and PowerMockito doesn't work. e.g. I could not suppress constructor of the class that extends MenuBar
or BorderPane
etc.
When I googled, I found out that for writing unit tests for the code that uses JavaFX there are some other frameworks needed (JemmyFX - seems not being updated for a long time, MarvinFX - very new, TestFX - has alpha version yet) and I realized there are no good or well-documented frameworks there at all. Here I mean that I could not find any related book.
Could anyone tell me which unit testing framework to use when writing the GUI in JavaFX?
Upvotes: 3
Views: 1372
Reputation: 3281
TestFX is without a doubt the best (and only) testing framework for JavaFX applications. The latest version is marked as 4.0.5-alpha
but it's quite usable and helpful. The reason for the alpha
tags is mostly related to missing Javadocs on classes and some experimental features that were added in the 4.x
series.
There were substantial documentation updates made between 4.0.4-alpha
and 4.0.5-alpha
.
Upvotes: 3