Why UI testing is SO hard? (and what we can do about it) - - PowerPoint PPT Presentation

why ui testing is so hard
SMART_READER_LITE
LIVE PREVIEW

Why UI testing is SO hard? (and what we can do about it) - - PowerPoint PPT Presentation

Why UI testing is SO hard? (and what we can do about it) ivan.inozemtsev@xored.com An abstract testing tool Control an application-under-test (start/ stop) Manage test resources (create/modify/ exchange) Maintain backward


slide-1
SLIDE 1

Why UI testing is SO hard?

ivan.inozemtsev@xored.com

(and what we can do about it)

slide-2
SLIDE 2

An abstract testing tool

  • Control an application-under-test (start/

stop)

  • Manage test resources (create/modify/

exchange)

  • Maintain backward compatibility
  • Execute tests (locate elements/send

commands/perform assertions)

slide-3
SLIDE 3

Testing Tool Runtime

  • Identifying and locating elements
  • Interacting with elements
  • Asserting their state
slide-4
SLIDE 4

How an application looks

slide-5
SLIDE 5

How user sees it

slide-6
SLIDE 6

How the tool sees it

slide-7
SLIDE 7

Locating elements

slide-8
SLIDE 8

Locating elements editors vs views

Editors Views

slide-9
SLIDE 9

Locating elements editors vs views

Editors Views

slide-10
SLIDE 10

Identifying caret position

StyledText.getCaretOffset() == 551

slide-11
SLIDE 11

Identifying headless windows

Proposals Documentation

slide-12
SLIDE 12

Performing Actions

slide-13
SLIDE 13

Clicking a context menu

  • User: click “Refresh” menu item
  • What can go wrong? Get a menu, find

an item, send event to it

  • item.getText() == Re&fresh\tF5
slide-14
SLIDE 14

Setting text

  • org.eclipse.swt.widgets.Text.setText(“foo”)

automatically sends SWT.Verify and SWT.Modify. What can be more simple?

  • Application: listens for KeyUp/Down events

to perform some extra actions, affecting UI

  • Fail
slide-15
SLIDE 15

Checking an item

  • Click or check/uncheck?
  • How to get/set current value?
  • MarkerViewerContentProvider
  • CheckboxCellEditor
slide-16
SLIDE 16

Asserting UI state

slide-17
SLIDE 17

Asserting Decorations

  • ControlDecoration is

not a control

  • No references from

control to decorations

  • How to assert its

presence and text?

slide-18
SLIDE 18

Asserting Images

  • Images contain a ton of

useful information

  • May be decorated by other

images

  • Don’t retain their origin –

just a handle to OS resource

On a screnshot:

  • rg.eclipse.jdt.ui/icons/full/obj16/field_private_obj.gif

decorated with final_co.gif and static_co.gif

slide-19
SLIDE 19

Asserting styled tree items

SWT TreeItem has no idea about those colors

slide-20
SLIDE 20

Main points

  • UI testing is really hard
  • Blackbox testing is a myth (or dream)
  • Someone has to be an expert in internals –

but who? Tool developers or QA engineers?

slide-21
SLIDE 21

RCP Testing Tool

  • Focus on Eclipse technologies
  • Support for SWT, JFace, Forms, Draw2D,

GEF, GMF, Graphiti

  • Control state of workspace, workbench,

preferences

  • Automatic tracking of jobs, Display execs,

databindings

slide-22
SLIDE 22

RCP Testing Tool – Demo

  • Introduce a compile error in Java Editor
  • Make sure it is displayed
  • In rulers
  • In editor (underlined)
  • In Package Explorer view
  • In Problems view
  • In Outline view
slide-23
SLIDE 23

RCP Testing Tool – Demo

  • State control
  • Recording just works
  • Human-readable identification of widgets
  • OS-independent hotkeys
  • Powerful assertions
slide-24
SLIDE 24

Highlights

with [get-editor "Program.java" | get-text-viewer] { set-caret-pos 3 44 key-type BackSpace } get-button "Save (M1+S)" | click

slide-25
SLIDE 25

Highlights

get-editor "Program.java" | get-left-ruler | get-ruler-column AnnotationColumn | hover-ruler -line 3

slide-26
SLIDE 26

Highlights

with [get-view Problems | get-tree] { get-item "Errors (1 item)/Syntax error.*" | get-property "image.path" | equals "org.eclipse.ui.ide/icons/full/obj16/ error_tsk.gif" | verify-true get-item "Errors (1 item)/Syntax error.*" | get-property "values['Location']" | equals "line 3" | verify-true }

slide-27
SLIDE 27

Highlights

get-view Outline | get-tree | get-item "Program/main(String[]) : void" | get-property "image.decorations[1].path" | equals "org.eclipse.jdt.ui/icons/full/ovr16/ error_co.gif" | verify-true

slide-28
SLIDE 28

What’s next?

  • http://eclipse.org/rcptt
  • http://www.eclipse.org/rcptt/

documentation/userguide/getstarted/

  • http://eclipse.org/forums/eclipse.rcptt
slide-29
SLIDE 29

Thank you!

Visit http://eclipse.org/rcptt