This discussion is archived
1 Reply Latest reply: Jan 31, 2013 12:42 PM by zmirc RSS

Proper testing? Experiences, TestNG, JemmyFX, Maven integration?

csh Journeyer
Currently Being Moderated
Hi

I'd like to build more stable UIs by integrate tests. My Frontend is basically split into a view class and a controller/presentation model class.

I've tried to only test the presentation model class by instantiating it and do my tests on it with a Framework like TestNG/JUnit. However, problems begin that for most things you need to be on the JavaFX Application thread, which isn't the case in a TestNG method.

So, I have to call Application.launch in my Test methods and put the actual test logic into the overriden start method.

It works, but is cumbersome and it doesn't feel like it is the best solution.

Do you have any suggestions for simple unit testing?

When I just put my test cases into Platform.runLater() without calling Application.launch, I get an exception "Toolkit is not initialized".


Then there is JemmyFX. I've never really worked with it. But it seems it really mimics the human user by simulating mousclicks and keyboard input and therefore really tests the actual UI.
Often this is more than I need.

Do you have any experiences with it? Is it worth it? Is there a Maven dependency for it?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points