1
<Insert Picture Here>
UI test automation techniques by an example of JavaFX UI.
Alexandre (Shura) Iline
Java quality archi...
The following is intended to outline our general product
direction. It is intended for information purposes, and
may not b...
4
The presented technology tested on
JavaFX Authoring Tool
5
<Insert Picture Here>
Agenda
• UI libraries features
(from testing perspective)
• UI Sample
• Jemmy tool
• Writing tests...
<Insert Picture Here>
UI features
7
UI libraries features
Looking from test side
• Hierarchy
• Controls
• Transformations
• Images
• Animation
• Event queue
8
Control hierarchy
http://java.sun.com/javafx/1.3/docs/api/
Stage
Scene
ParentControl
Node
9
Controls
Button
ToggleButton
RadioButton
CheckBox
Slider
ScrollBar
TextBox
ListView
ComboBox
Custom controls
http://java...
10
Transformations
http://java.sun.com/javafx/1.3/docs/api/
Affine
Rotate
Scale
Shear
Translate
11
Images
12
Animation
http://java.sun.com/javafx/1.3/docs/api/
Timeline
Interpolator
KeyFrame
PathTransition
RotateTransition
Scale...
13
User
UI
Other
threads
Event queue
14
Tested UI
A Bézier curve is a
parametric curve
frequently used in
computer graphics and
related fields.
<Insert Picture Here>
Jemmy tool
16
Find Do VerifyPass Pass
Pass
Fail Fail Fail
Failure analysis
Find next control
To perform operation
Verify that expecte...
17
JemmyCore
JemmySGJemmy v2
AWT & Swing
JemmyRemote
JemmyFXRemoteJemmyFX
JemmySWT
JRMC
JavaFX Authoring
Tool
JavaFX
LCDUI...
18
Hierarchy Criteria
Text
Scroller
Selectable
Mouse
Keyboard
Interfaces
Lookup
Properties
Images
Factory
Comparator
Inter...
19
Scenes,
nodes
Hierarchy Criteria
AWT Robot
Text
AWT Robot
Scroller
Selectable
Mouse
Keyboard
Custom
Interfaces
Lookup
C...
<Insert Picture Here>
Let's test
21
One line test
22
• Type
• Property
– text
– value
– ID
– tooltip
• Image
• Coordinated
• Index (last resort)
• Any criteria which could ...
23
Lookup code
24
More lookup code
25
Control interfaces
Control type Properties
Node Mouse, Keyboard
Control Focusable
ToggleButton Selectable
Text Selectio...
26
Control interfaces usage code
27
JemmyFX Browser
28
UI test
• Customize ...
– Curve attributes
– View attributes
• Verify image
• Generate code
• Verify code
• Start anima...
29
Test
30
Waitings
Every UI action takes time
• Wait for everything
– Window appearance
– Label change
– Image appearance
– Prope...
31
Waiting code
32
User
UI
Other
threads
Event queue
33
UI
Other
threads
Event queue with a test
Test
Actions
Verifications
Lookup
34
Pull data through queue
35
Properties
Control type Properties
Node ID bounds
Control get$tooltip get$cursor
ToggleButton get$pressed
Text text get...
36
Properties code
37
Images
- =
Expected Actual Diff
38
Images code
39
Animation code
40
Verifying generated code
41
TD + *TS NR
TM * NR
NC*
EA =
NC
*
TM
– time needed to run the tests manually
TD
– time needed for automated test develo...
42
What about record&replay?
• Pretty low TD
– Pretty much the same as TM
… but ...
• High TS
– Generates unmaintainable c...
43
Ideal test
• Lives forever
• Written in terms of domain model
• All the UI logic is hidden within a library
<Insert Picture Here>
Remote testing
45
Hierarchy Criteria
Text
Scroller
Selectable
Mouse
Keyboard
Interfaces
Lookup
By
properties
Properties
Images
Factory
Co...
46
JemmyRemote
• Benefits
– Low load on tested UI
– Ability to run on low-end devices
• Limitations
– Two-part code
– Look...
47
AWTRobot
AWTRobot
Hierarchy Criteria
Text
Scroller
Selectable
Mouse
Keyboard
Interfaces
Lookup
By
properties
Properties...
48
JemmyFXRemote sample
49
http://jemmy.dev.java.net
References
alexandre.iline@oracle.com
alexander.kouznetsov@oracle.com
https://jemmy.dev.java....
<Insert Picture Here>
UI test automation techniques by an example of JavaFX UI.
Alexandre (Shura) Iline
Java quality archi...
51
Backup slides
52
Operators API
<Control type name>Operator.find(SceneOperator, <lookup data>)
53
JemmyFXScript
Upcoming SlideShare
Loading in...5
×

Александр Ильин, Oracle, - Технология автоматизации тестирования пользовательского интерфейса на примере JavaFX

761

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
761
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Александр Ильин, Oracle, - Технология автоматизации тестирования пользовательского интерфейса на примере JavaFX

  1. 1. 1
  2. 2. <Insert Picture Here> UI test automation techniques by an example of JavaFX UI. Alexandre (Shura) Iline Java quality architect
  3. 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. 4. 4 The presented technology tested on JavaFX Authoring Tool
  5. 5. 5 <Insert Picture Here> Agenda • UI libraries features (from testing perspective) • UI Sample • Jemmy tool • Writing tests • Reduce test cost support • Remote testing
  6. 6. <Insert Picture Here> UI features
  7. 7. 7 UI libraries features Looking from test side • Hierarchy • Controls • Transformations • Images • Animation • Event queue
  8. 8. 8 Control hierarchy http://java.sun.com/javafx/1.3/docs/api/ Stage Scene ParentControl Node
  9. 9. 9 Controls Button ToggleButton RadioButton CheckBox Slider ScrollBar TextBox ListView ComboBox Custom controls http://java.sun.com/javafx/1.3/docs/api/
  10. 10. 10 Transformations http://java.sun.com/javafx/1.3/docs/api/ Affine Rotate Scale Shear Translate
  11. 11. 11 Images
  12. 12. 12 Animation http://java.sun.com/javafx/1.3/docs/api/ Timeline Interpolator KeyFrame PathTransition RotateTransition ScaleTransition TranslateTransition
  13. 13. 13 User UI Other threads Event queue
  14. 14. 14 Tested UI A Bézier curve is a parametric curve frequently used in computer graphics and related fields.
  15. 15. <Insert Picture Here> Jemmy tool
  16. 16. 16 Find Do VerifyPass Pass Pass Fail Fail Fail Failure analysis Find next control To perform operation Verify that expected State reached Perform necessary actions UI test workflow
  17. 17. 17 JemmyCore JemmySGJemmy v2 AWT & Swing JemmyRemote JemmyFXRemoteJemmyFX JemmySWT JRMC JavaFX Authoring Tool JavaFX LCDUI NetBeans JDK Jemmy and extensions Jemmy v3 JemmyAWT
  18. 18. 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 Scroller PropertiesAPIImagesAPI InputAPILookupAPI
  19. 19. 19 Scenes, nodes Hierarchy Criteria AWT Robot Text AWT Robot Scroller Selectable Mouse Keyboard Custom Interfaces Lookup Coords Text ID Properties Images AWTRobot Factory Comparator FXRobot Thum b Scroller Interfaces API JemmyFX FXRobot PropertiesAPIImagesAPI InputAPIOperatorsAPILookupAPI
  20. 20. <Insert Picture Here> Let's test
  21. 21. 21 One line test
  22. 22. 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 ...
  23. 23. 23 Lookup code
  24. 24. 24 More lookup code
  25. 25. 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>
  26. 26. 26 Control interfaces usage code
  27. 27. 27 JemmyFX Browser
  28. 28. 28 UI test • Customize ... – Curve attributes – View attributes • Verify image • Generate code • Verify code • Start animation • Verify animation
  29. 29. 29 Test
  30. 30. 30 Waitings Every UI action takes time • Wait for everything – Window appearance – Label change – Image appearance – Property change – File update • Configurable timeouts • Exceptions
  31. 31. 31 Waiting code
  32. 32. 32 User UI Other threads Event queue
  33. 33. 33 UI Other threads Event queue with a test Test Actions Verifications Lookup
  34. 34. 34 Pull data through queue
  35. 35. 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
  36. 36. 36 Properties code
  37. 37. 37 Images - = Expected Actual Diff
  38. 38. 38 Images code
  39. 39. 39 Animation code
  40. 40. 40 Verifying generated code
  41. 41. 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
  42. 42. 42 What about record&replay? • Pretty low TD – Pretty much the same as TM … but ... • High TS – Generates unmaintainable code – No test code encapsulation
  43. 43. 43 Ideal test • Lives forever • Written in terms of domain model • All the UI logic is hidden within a library
  44. 44. <Insert Picture Here> Remote testing
  45. 45. 45 Hierarchy Criteria Text Scroller Selectable Mouse Keyboard Interfaces Lookup By properties Properties Images Factory Comparator JemmyRemote Desktop Device Properties Socket Hierarchy
  46. 46. 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
  47. 47. 47 AWTRobot AWTRobot Hierarchy Criteria Text Scroller Selectable Mouse Keyboard Interfaces Lookup By properties Properties Images Factory Comparator JemmyFXRemote Desktop Device Properties Socket FXRobot Scenes, nodes
  48. 48. 48 JemmyFXRemote sample
  49. 49. 49 http://jemmy.dev.java.net References alexandre.iline@oracle.com alexander.kouznetsov@oracle.com https://jemmy.dev.java.net/AutomationEffectiveness.html https://jemmy.dev.java.net/RecordingVSCoding.html users@dev.java.net
  50. 50. <Insert Picture Here> UI test automation techniques by an example of JavaFX UI. Alexandre (Shura) Iline Java quality architect
  51. 51. 51 Backup slides
  52. 52. 52 Operators API <Control type name>Operator.find(SceneOperator, <lookup data>)
  53. 53. 53 JemmyFXScript
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×