![Page 1: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/1.jpg)
1
![Page 2: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/2.jpg)
<Insert Picture Here>
UI test automation techniques by an example of JavaFX UI.
Alexandre (Shura) IlineJava quality architect
![Page 3: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/3.jpg)
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.
![Page 4: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/4.jpg)
4
The presented technology tested on
JavaFX Authoring Tool
![Page 5: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/5.jpg)
5
<Insert Picture Here>
Agenda
• UI libraries features
(from testing perspective)• UI Sample• Jemmy tool• Writing tests• Reduce test cost support• Remote testing
![Page 6: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/6.jpg)
<Insert Picture Here>
UI features
![Page 7: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/7.jpg)
7
UI libraries features Looking from test side
• Hierarchy• Controls• Transformations• Images• Animation• Event queue
![Page 8: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/8.jpg)
8
Control hierarchy
http://java.sun.com/javafx/1.3/docs/api/
Stage
Scene
ParentControl
Node
![Page 9: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/9.jpg)
9
Controls
Button
ToggleButton
RadioButton
CheckBox
Slider
ScrollBar
TextBox
ListView
ComboBox
Custom controls
http://java.sun.com/javafx/1.3/docs/api/
![Page 10: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/10.jpg)
10
Transformations
http://java.sun.com/javafx/1.3/docs/api/
Affine
Rotate
Scale
Shear
Translate
![Page 11: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/11.jpg)
11
Images
![Page 12: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/12.jpg)
12
Animation
http://java.sun.com/javafx/1.3/docs/api/
Timeline
Interpolator
KeyFrame
PathTransition
RotateTransition
ScaleTransition
TranslateTransition
![Page 13: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/13.jpg)
13
User
UI
Otherthreads
Event queue
![Page 14: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/14.jpg)
14
Tested UI
A Bézier curve is a parametric curve frequently used in computer graphics and related fields.
![Page 15: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/15.jpg)
<Insert Picture Here>
Jemmy tool
![Page 16: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/16.jpg)
16
Find Do Ver i fyPass Pass
Pass
Fai l Fai l Fai l
Fai lure analys is
Find next control
To per form operat ion
Ver i fy that expected
State reached
Perform necessary
act ions
UI test workflow
![Page 17: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/17.jpg)
17
JemmyCore
JemmySGJemmy v2
AWT & Swing
JemmyRemote
JemmyFXRemoteJemmyFXJemmySWT
JRMCJavaFX Authoring
Tool JavaFX
LCDUINetBeans
JDK
Jemmy and extensions
Jemmy v3
JemmyAWT
![Page 18: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/18.jpg)
18
Hierarchy Criteria
Text
Scroller
Selectable
Mouse
Keyboard
Interfaces
Lookup
Properties
Images
Factory
Comparator
Interfaces API
JemmyCore
AWTRobot
AWT Robot
Text
Scroller
Selectable
Custom
Coords
Thumb ScrollerPro
per
ties
AP
IIm
ages
AP
I
Inp
ut A
PI
Lo
oku
p A
PI
![Page 19: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/19.jpg)
19
Scenes,nodes
Hierarchy Criteria
AWT Robot
Text
AWT Robot
Scroller
Selectable
Mouse
KeyboardC
usto
m
Interfaces
Lookup
Co
ord
s
Text
ID
Properties
Images
AWTRobot
Factory
Comparator
FX R
obot
Thumb Scroller
Interfaces API
JemmyFX
FXRobot
Pro
per
ties
AP
IIm
ages
AP
I
Inp
ut A
PI
Op
erators A
PI
Lo
oku
p A
PI
![Page 20: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/20.jpg)
<Insert Picture Here>
Let's test
![Page 21: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/21.jpg)
21
One line test
![Page 22: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/22.jpg)
22
• Type• Property
– text– value– ID– tooltip
• Image• Coordinated• Index (last resort)
• Any criteria which could be written in java code
Lookup principles
Test should be able to find control by ...
![Page 23: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/23.jpg)
23
Lookup code
![Page 24: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/24.jpg)
24
More lookup code
![Page 25: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/25.jpg)
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>
![Page 26: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/26.jpg)
26
Control interfaces usage code
![Page 27: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/27.jpg)
27
JemmyFX Browser
![Page 28: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/28.jpg)
28
UI test
• Customize ...– Curve attributes– View attributes
• Verify image• Generate code• Verify code• Start animation• Verify animation
![Page 29: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/29.jpg)
29
Test
![Page 30: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/30.jpg)
30
Waitings
Every UI action takes time
• Wait for everything– Window appearance– Label change– Image appearance– Property change– File update
• Configurable timeouts
• Exceptions
![Page 31: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/31.jpg)
31
Waiting code
![Page 32: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/32.jpg)
32
User
UI
Otherthreads
Event queue
![Page 33: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/33.jpg)
33
UI
Otherthreads
Event queue with a test
Test
Actions
Verifications
Lookup
![Page 34: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/34.jpg)
34
Pull data through queue
![Page 35: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/35.jpg)
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
![Page 36: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/36.jpg)
36
Properties code
![Page 37: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/37.jpg)
37
Images
- =
Expected Actual Diff
![Page 38: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/38.jpg)
38
Images code
![Page 39: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/39.jpg)
39
Animation code
![Page 40: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/40.jpg)
40
Verifying generated code
![Page 41: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/41.jpg)
41
TD + *TS NR
TM * NR NC*EA =
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
Test automation effectiveness
![Page 42: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/42.jpg)
42
What about record&replay?
• Pretty low TD
– Pretty much the same as TM
… but ...
• High TS
– Generates unmaintainable code– No test code encapsulation
![Page 43: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/43.jpg)
43
Ideal test
• Lives forever• Written in terms of domain model• All the UI logic is hidden within a library
![Page 44: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/44.jpg)
<Insert Picture Here>
Remote testing
![Page 45: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/45.jpg)
45
Hierarchy Criteria
Text
Scroller
Selectable
Mouse
Keyboard
Interfaces
Lookup
By
pro
perties
Properties
Images
Factory
Comparator
JemmyRemote
Desktop Device
Properties
Socket
Hierarchy
![Page 46: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/46.jpg)
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
![Page 47: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/47.jpg)
47
AWTRobot
AW
T R
ob
ot
Hierarchy Criteria
Text
Scroller
Selectable
Mouse
Keyboard
Interfaces
Lookup
By
pro
perties
Properties
Images
Factory
Comparator
JemmyFXRemote
Desktop Device
Properties
SocketFXRobot
Scenes,nodes
![Page 48: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/48.jpg)
48
JemmyFXRemote sample
![Page 49: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/49.jpg)
49
http://jemmy.dev.java.net
References
https://jemmy.dev.java.net/AutomationEffectiveness.html
https://jemmy.dev.java.net/RecordingVSCoding.html
![Page 50: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/50.jpg)
<Insert Picture Here>
UI test automation techniques by an example of JavaFX UI.
Alexandre (Shura) IlineJava quality architect
![Page 51: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/51.jpg)
51
Backup slides
![Page 52: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/52.jpg)
52
Operators API
<Control type name>Operator.find(SceneOperator, <lookup data>)
![Page 53: UI test automation techniques by an example of JavaFX UI](https://reader031.vdocuments.us/reader031/viewer/2022020101/559889d71a28ab4f398b47dc/html5/thumbnails/53.jpg)
53
JemmyFXScript