JavaFX UIs not so testable?

15 views
Skip to first unread message

Alex Ruiz

unread,
Dec 11, 2008, 11:57:51 AM12/11/08
to java...@googlegroups.com
Greetings,

I've been trying to perform a functional test on a very simple JavaFX UI. The test is written in Java and needs to instantiate and show the JavaFX UI to test. It was tricky, but finally I got it working. I'm using FEST-Swing (disclaimer: I'm the creator) to simulate user input and test the UI. Under the covers, FEST uses the AWT Robot, which generates *native* user input events. Clicking on a button works fine on a plain-old Swing UI, but fails miserably on a JavaFX one. I suspect there is a bug in the action listener that JavaFX attaches to the JButtons. It seems that testability was not in the scope of JavaFX.

I documented my experience at http://www.jroller.com/alexRuiz/entry/using_fest_swing_to_discover

Any comments/suggestions are appreciated :)

Best regards,
-Alex

Joshua Marinacci

unread,
Dec 12, 2008, 4:09:14 AM12/12/08
to java...@googlegroups.com
Currently JavaFX does not have any testing infrastructure, but there
is no reason why the awt.Robot classes shouldn't work. Please file a
bug on it. BTW, our bug database is now public at


http://javafx-jira.kenai.com/

Thanks,
Josh

Alex Ruiz

unread,
Dec 12, 2008, 9:18:46 AM12/12/08
to java...@googlegroups.com
Thanks Josh, I'll do that.

Best regards,
-Alex

robogeek

unread,
Dec 12, 2008, 9:49:51 AM12/12/08
to The Java Posse

Hey Alex,

Not all the widgets that appear in a JavaFX app are subclasses of
java.awt.Component and are not necessarily discoverable through
walking the Component hierarchy. I haven't looked too deeply into
this but the implement is really riding atop the Scenegraph model. A
scenegraph Node is not an awt.Component and therefore Nodes do not
show up in the Component hierarchy. If FEST is relying on the
Component hierarchy it might be missing things.

There is some kind of containering of scenegraph Nodes into the
Component hierarchy. But at some point in FEST you'll have to switch
search strategies to look through the Node hierarchy.

We should have this discussion on the java-gui-testing group on
yahoo.groups.

Another issue here is that the toolset you've developed and the other
Java GUI testing tools are not relevant when the app is on a mobile
device. The MIDP platform does not include java.awt.Robot and a Robot
based tool cannot be used for automating test execution on a mobile
device.

And as Josh said.. Robot can click anywhere on the screen so it's not
an issue with Robot. It is an issue with testability.

- David Herron


On Dec 11, 8:57 am, "Alex Ruiz" <alex.ruiz...@gmail.com> wrote:
> Greetings,
>
> I've been trying to perform a functional test on a very simple JavaFX UI.
> The test is written in Java and needs to instantiate and show the JavaFX UI
> to test. It was tricky, but finally I got it working. I'm using FEST-Swing
> (disclaimer: I'm the creator) to simulate user input and test the UI. Under
> the covers, FEST uses the AWT Robot, which generates *native* user input
> events. Clicking on a button works fine on a plain-old Swing UI, but fails
> miserably on a JavaFX one. I suspect there is a bug in the action listener
> that JavaFX attaches to the JButtons. It seems that testability was not in
> the scope of JavaFX.
>
> I documented my experience athttp://www.jroller.com/alexRuiz/entry/using_fest_swing_to_discover

Alex Ruiz

unread,
Dec 12, 2008, 3:13:04 PM12/12/08
to java...@googlegroups.com
Hi David,

Thank you so much for your reply. I appreciate it :)

About the component hierarchy, I had a similar thought. We might need to provide a different strategy for JavaFX destop UIs.

I agree, the current Swing-based testing tools might only be able to test JavaFX *desktop* apps. An implementation for mobile devices could be really cool project...ahh! if the day had more than 24 hours! :D

I'll start a thread about this topic in the java-gui-testing group shortly.

Best regards,
-Alex
Reply all
Reply to author
Forward
0 new messages