Hi,

Would it be a good idea to include a mocking library like Mockito to FX's test tools?

I often find myself wanting to test components in isolation, to avoid having to spin up large parts of FX to even get something as simple as a Control testable.  So far I've avoided the issue as I've been working mostly in javafx.base which can be tested pretty easily.  However, in javafx.graphics I find that testing is a lot more cumbersome, and I think as a result, many things are not tested as well as they should be.

A mocking library can help immensily with this burden, allowing you to test components like Skins and Behaviors in isolation by providing a Control mock.

In my exploration of a potential Behavior API, I noticed quite a few edge cases that are not tested at all, or would be very hard to test if one has to use real components and get them to be in a very specific state to test the edge case.

It's use of course would at the disgression of the test author, and normally such a library gets included the first time someone needs it, but in FX I think this process is a bit more formal (as it is was with the JUnit 5 upgrade, requiring some external approval I think) and so I'd like to get this library in before we need it.

--John

Reply via email to