This document discusses techniques for automating user interface (UI) testing using JavaFX. It begins with an overview of common UI features from a testing perspective, such as control hierarchies, different types of controls, transformations, images, animation, and event queues. It then demonstrates how to automate testing using the Jemmy tool and extensions for JavaFX. Specific techniques covered include looking up controls, performing actions, verifying states, handling waiting periods, and testing remotely. The goal is to help reduce the time and cost of automated UI testing.
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.
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
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
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
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
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
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
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