Александр Ильин, oracle, - Технология автоматизации...

Post on 22-Nov-2014

1.066 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

1

<Insert Picture Here>

UI test automation techniques by an example of JavaFX UI.

Alexandre (Shura) IlineJava quality architect

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

5

<Insert Picture Here>

Agenda

• UI libraries features

(from testing perspective)• UI Sample• Jemmy tool• Writing tests• Reduce test cost support• Remote testing

<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.sun.com/javafx/1.3/docs/api/

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

ScaleTransition

TranslateTransition

13

User

UI

Otherthreads

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 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

17

JemmyCore

JemmySGJemmy v2

AWT & Swing

JemmyRemote

JemmyFXRemoteJemmyFXJemmySWT

JRMCJavaFX Authoring

Tool JavaFX

LCDUINetBeans

JDK

Jemmy and extensions

Jemmy v3

JemmyAWT

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

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

<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 be written in java code

Lookup principles

Test should be able to find control by ...

23

Lookup code

24

More lookup code

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

Control interfaces usage code

27

JemmyFX Browser

28

UI test

• Customize ...– Curve attributes– View attributes

• Verify image• Generate code• Verify code• Start animation• Verify animation

29

Test

30

Waitings

Every UI action takes time

• Wait for everything– Window appearance– Label change– Image appearance– Property change– File update

• Configurable timeouts

• Exceptions

31

Waiting code

32

User

UI

Otherthreads

Event queue

33

UI

Otherthreads

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$strikethrough get$underline

Slider, ScrollBar vertical minimum maximum value

CheckBox state is.tri.state

TextInputControl selection.anchor position text get$columns get$editable

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 development

TS – time needed for automated test support

NR – number of test runs

NC – number of tested configurations

Test automation effectiveness

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

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

pro

perties

Properties

Images

Factory

Comparator

JemmyRemote

Desktop Device

Properties

Socket

Hierarchy

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

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

48

JemmyFXRemote sample

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

<Insert Picture Here>

UI test automation techniques by an example of JavaFX UI.

Alexandre (Shura) IlineJava quality architect

51

Backup slides

52

Operators API

<Control type name>Operator.find(SceneOperator, <lookup data>)

53

JemmyFXScript

top related