Link Details

Link 146439 thumbnail
User 133076 avatar

By dk38335
via blog.marathontesting.com
Published: Jan 05 2009 / 22:49

Using Marathon to test a JavaFX application (though only with Swing components).
  • 3
  • 3
  • 1339
  • 265

Comments

Add your comment
User 134694 avatar

alruiz15 replied ago:

1 votes Vote down Vote up Reply

I don't know what happened to Gregg's and my comments.

Again: I appreciate the link to my blog (from the article.) But, I don't believe any current Swing testing tool can work with JavaFX without any changes. Although JavaFX supports Swing components, the component hierarchy is completely different.

User 133076 avatar

dk38335 replied ago:

0 votes Vote down Vote up Reply

Hmm... I just said that it worked :). Atleast the examples that are on the page I referred. When I started on this, I expected some amount of trouble and was pleasantly surprised that it worked without any changes.

I think the difference between the Fest and Marathon is that Marathon posts the events to the system event queue, where as Fest is using Robot.

User 134694 avatar

alruiz15 replied ago:

0 votes Vote down Vote up Reply

Aha! good point! by using AWT events you bypass all the node/component hierarchy and get directly to the component. I'll like to see more examples of Marathon though. I'm taking back my "vote down"...

User 133076 avatar

dk38335 replied ago:

0 votes Vote down Vote up Reply

Thanks. BTW, I observed the component#getLocationOnScreen returns proper values where as getLocation returns (0,0). Might be of use for Robot to actually click.

User 134694 avatar

alruiz15 replied ago:

0 votes Vote down Vote up Reply

I had to use the coordinates from the node containing the Swing component. Quick question, how do you simulate drag and drop using AWT events? I could only do it with the AWT Robot.

User 133076 avatar

dk38335 replied ago:

0 votes Vote down Vote up Reply

I also tried it and you can't :(

So, Marathon implements a minimal drag and drop using TransferHandler (The Cut&Paste mechanism). The DnD event is recorded by listening for the events, but the actual DnD happens using a different mechanism. This also precludes from recording and playing DnD events from outside the application. I know of some applications specifically implementing Cut&Paste so that they can record DnD using Marathon.

User 133076 avatar

dk38335 replied ago:

0 votes Vote down Vote up Reply

Talking about component hierarchy, Does JavaFX has any other built-in controls other than TextBox? I was playing around with TextBox to get the contents and found that it is quite complicated. In the end, I got to search the whole component hierarchy to get the handle for SGText and get the content.
And also, since we can expect lots of custom components (I saw two progress bars already) is there anything that the component developers add to the components so that the testing tools can support them? Over this weekend, I will take a look at this again.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (3)



Voters Against This Link (3)