Closed hastebrot closed 8 years ago
Have you tried just creating an instance of JFXPanel? I always found that the easiest way to kick off the JavaFX thread.
Jemmy (another UI test framework for JavaFX) and FEST-Swing (one for Swing) both completely require fixture classes for each UI control.
TestFX doesn't require fixture classes for user-interactions, but needs to implement fixtures for matchers that verify the state of UI controls.
I really appreciate this initiative. I haven't really done much UI testing, but now's the time to get started :)
Let's go with TestFX! Will you set up the dependencies and create a PR?
Have you tried just creating an instance of JFXPanel?
@thomasnield This should also be possible. Instead of hasChild()
we could use the Node
s methods directly. This would require less dependencies.
(I'm a bit biased, because I'm the maintainer of TestFX and like to improve the UI control matchers :smile_cat:)
Let's go with TestFX! Will you set up the dependencies and create a PR?
I will. But first gotta go to sleep (Europe/Berlin timezone here).
@thomasnield: Can I use JFXPanel
multiple times?
I'm curious to take a look at TestFX since I am the maintainer of RxJavaFX. I've been left with some misbehaving JavaFX tests.
Yes you can.
With JFXPanel
, this is genius. One problem is, that I really need to fetch the primary Stage
. Seems with JFXPanel
it is not that easy.
I'm curious to take a look at TestFX since I am the maintainer of RxJavaFX. I've been left with some misbehaving JavaFX tests.
I'm happy to help you with TestFX, but first I need to implement some tests for TornadoFX.
@hastebrot that's nice of you thank you. No rush, even if it takes weeks. This issue I filed has been driving me up the wall. https://github.com/ReactiveX/RxJavaFX/issues/22
I think this could also lead to very constructive criticism on how to test controls. I haven' t had much feedback in this area about TestFX's API, and am eager to receive some criticism.
I know little about JavaFX testing so I'm curious to see how this works. Look forward to it.
When I added the fix for the tab builder I thought "how nice it would be to have tests for the builders!".. hehe :) It would be super nice to get the structure for builder tests set up, even if we don't have tests for everything. Would you like push access to the project, btw @hastebrot ?
@edvin Sure, why not. :smiley:
Granted :)
Thanks.
@hastebrot Do you have time to integrate some more tests here? Once I get some examples, I'm sure I can start fleshing out more tests, but I find it a bit hard to get started. If you don't have the time, I understand completely. Please let me know :)
@edvin Yes, I want to write more tests for the builders. This or the next week, when I find time.
Thanks @hastebrot :))
I'll close this issue for now, feel free to reopen if you get some time in your schedule to look at it :)
To test the builder pattern functions we need to create
Node
s, thus we need to start the JavaFX thread.There are JfxRunner (used by mvvmFX), Automaton and TestFX to start the JavaFX thread.
I'd like to improve TestFX's
hasChildren()
matcher and test the functions inBuilders.kt
with it. A test could look like this: