Your SlideShare is downloading. ×
UI test automation techniques by an example of JavaFX UI
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

UI test automation techniques by an example of JavaFX UI


Published on

Test automation is an essential part of a software development process. Being used wisely, it …

Test automation is an essential part of a software development process. Being used wisely, it

• optimizes testing resources,

• increases testing quality,

• leads to earlier bug detection,

• allows to build continuous development processes.

UI Test automation requires tools, experience and human time investment. The session demonstrates a solution used by Java and JavaFX quality team based on experience of testing such products as Swing, NetBeans, JavaFX SDK and JavaFX Authoring tool. The solution is designed to address the key aspects of UI test automation: effectiveness, test base scalability, stability, and maintainability. The core part of the solution is an open source high-level UI test library Jemmy. During the session, Alexandre will be creating JavaFX UI tests from scratch and demonstrating existing test base for real JavaFX products. He will give an overview of JemmyFX API and explain how UI test automation aspects are applied to real test code. The session is intended for Java and JavaFX UI application developers and quality engineers as well as for everyone interested in UI testing techniques and approaches

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. 1
  • 2. <Insert Picture Here> UI test automation techniques by an example of JavaFX UI. Alexandre (Shura) Iline Java quality architect
  • 3. The following is intended to outline our general product direction. It is intended for information purposes, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle's products remains at the sole discretion of Oracle.
  • 4. The presented technology tested on JavaFX Authoring Tool 4
  • 5. Agenda • UI libraries features <Insert Picture Here> (from testing perspective) • UI Sample • Jemmy tool • Writing tests • Reduce test cost support • Remote testing 5
  • 6. <Insert Picture Here> UI features
  • 7. UI libraries features Looking from test side • Hierarchy • Controls • Transformations • Images • Animation • Event queue 7
  • 8. Control hierarchy Stage Control Parent Node Scene 8
  • 9. Controls Button ToggleButton RadioButton CheckBox Slider ScrollBar TextBox ListView ComboBox Custom controls 9
  • 10. Transformations Affine Rotate Scale Shear Translate 10
  • 11. Images 11
  • 12. Animation Timeline Interpolator KeyFrame PathTransition RotateTransition ScaleTransition TranslateTransition 12
  • 13. Event queue User UI Other threads 13
  • 14. Tested UI A Bézier curve is a parametric curve frequently used in computer graphics and related fields. 14
  • 15. <Insert Picture Here> Jemmy tool
  • 16. UI test workflow Pass Perform necessary actions Find Pass Do Pass Verify Find next control Verify that expected Fail To perform operation Fail State reached Fail Failure analysis 16
  • 17. Jemmy and extensions Jemmy v2 LCDUI NetBeans JemmySG AWT & Swing JDK JemmyAWT JemmyCore JemmyRemote JemmySWT Jemmy v3 JemmyFX JemmyFXRemote JRMC JavaFX Authoring JavaFX Tool 17
  • 18. JemmyCore Text Interfaces API Scroller Input API Properties API Properties Interfaces Selectable Text Mouse AWT Robot Scroller Keyboard Thumb Scroller Selectable Images Lookup Comparator Hierarchy Criteria Images API Lookup API Factory Coords AWTRobot Custom 18
  • 19. JemmyFX Interfaces API Input API Properties API Properties Interfaces Mouse ot Text ob R AWT Robot FX Scroller Keyboard Operators API Selectable AWT Robot Images Lookup Comparator Hierarchy Criteria Images API Custom Coords Th Lookup API um Text Factory Scenes, ID nodes b Sc ro FXRobot AWTRobot lle r 19
  • 20. <Insert Picture Here> Let's test
  • 21. One line test 21
  • 22. Lookup principles Test should be able to find control by ... • Type • Property – text – value – ID – tooltip • Image • Coordinated • Index (last resort) • Any criteria which could be written in java code 22
  • 23. Lookup code 23
  • 24. More lookup code 24
  • 25. Control interfaces Control type Properties Node Mouse, Keyboard Control Focusable ToggleButton Selectable Text SelectionText ScrollBar, Slider Scroll ListView Scroll, Parent<? extends Object> Scene, Group Parent<Node> 25
  • 26. Control interfaces usage code 26
  • 27. JemmyFX Browser 27
  • 28. UI test • Customize ... – Curve attributes – View attributes • Verify image • Generate code • Verify code • Start animation • Verify animation 28
  • 29. Test 29
  • 30. Waitings Every UI action takes time • Wait for everything – Window appearance – Label change – Image appearance – Property change – File update • Configurable timeouts • Exceptions 30
  • 31. Waiting code 31
  • 32. Event queue User UI Other threads 32
  • 33. Event queue with a test Lookup Actions Verifications Test UI Other threads 33
  • 34. Pull data through queue 34
  • 35. Properties Control type Properties Node ID bounds Control get$tooltip get$cursor ToggleButton get$pressed Text text get$strikethrough get$underline Slider, ScrollBar vertical minimum maximum value CheckBox state is.tri.state TextInputControl selection.anchor position text get$columns get$editable 35
  • 36. Properties code 36
  • 37. Images - = Expected Actual Diff 37
  • 38. Images code 38
  • 39. Animation code 39
  • 40. Verifying generated code 40
  • 41. Test automation effectiveness TM * NR * NC EA = TD + TS * NR * NC TM – time needed to run the tests manually TD – time needed for automated test development TS – time needed for automated test support NR – number of test runs NC – number of tested configurations 41
  • 42. What about record&replay? • Pretty low TD – Pretty much the same as TM … but ... • High TS – Generates unmaintainable code – No test code encapsulation 42
  • 43. Ideal test • Lives forever • Written in terms of domain model • All the UI logic is hidden within a library 43
  • 44. <Insert Picture Here> Remote testing
  • 45. JemmyRemote Desktop Device Properties Interfaces Properties Text Mouse Scroller Keyboard Selectable Socket Images Lookup Comparator Hierarchy properties Criteria Hierarchy By Factory 45
  • 46. JemmyRemote • Benefits – Low load on tested UI – Ability to run on low-end devices • Limitations – Two-part code – Lookup is only through properties – Slow 46
  • 47. JemmyFXRemote Desktop Device AW Properties Interfaces Properties T Mouse Rob Text ot Scroller Keyboard Selectable Socket Images Lookup FXRobot Comparator Hierarchy properties Criteria Scenes, By Factory nodes AWTRobot 47
  • 48. JemmyFXRemote sample 48
  • 49. References 49
  • 50. <Insert Picture Here> UI test automation techniques by an example of JavaFX UI. Alexandre (Shura) Iline Java quality architect
  • 51. Backup slides 51
  • 52. Operators API <Control type name>Operator.find(SceneOperator, <lookup data>) 52
  • 53. JemmyFXScript 53