SlideShare una empresa de Scribd logo
1 de 56
Олег Бунин
Testing JavaFX UI
Tips from JavaFX quality team
Alexandre (Shura) Iline
Java and JavaFX quality architect
Oracle
Agenda
●UI testing overview
●Test automation approaches
●Jemmy library
●Test automation effectiveness
●Test library design approaches
UI testing … by Wikipedia
«GUI software testing is the process of
testing a product that uses a graphical user
interface, to ensure it meets its written
specifications.»
UI testing … most often ...
«Checking whether usage of a product UI
leads to results expected by the the person
who performs testing»
●Start text editor
●Push «File/Open»
●Verify file chooser directory
●Select some file
●Verify editor area content
●Verify application title
●Verify buttons availabilities
●....
UI Testing Manual Automated
Initial step Design test specification. Create tests.
Establish regular runs.
Ongoing Click, click, click Analize results
File bugs
Change the specification Change the tests
Qualification High, low for test executors High
Effectiveness Low High
Other Inexpensive to start Continuous quality monitoring ,
inexpensive to reuse
Fun Bo-o-o-ring Much like programming
Development
Continuous build
Commit
Build
Executed
automagically
after commit
Success
Analysis.
Rollback!!!
Code
changes
No
Yes.
Promote
Code is compilableTest further
Continuous build with testing
Commit
Build Success
Testing
Is it working?
Passed
Analysis.
Rollback!!!
Code
changes
Test
changes
No
No
Test further
Build is good
Code line is healthy
Go on ...
Yes
Yes.
= Compilation
successful
Automation
approach
Record && Replay Coding
Test creation Inexpensive*
Usually just repeating manual test
in special environment
Must be accompanied by other
means
Expensive*
Consists of programming
Test execution Does not depend on approach
Test
maintanance
Higher (in most cases)*
Very much depends on test format
Lower*
Depends on principles of
building test library
Test analysis Does not depend on approach
(*) Much more information closer to the end of this presentation
Jemmy
Jemmy v2
Started as a tool to tests TeamWare UI (1999)
Used for NetBeans extensions (2000)
Official test tool for NetBeans (2001)
Open-source (2001)
Jemmy v3
Started in (2008) as a proof of concept experiemnt
Extended to support JavaFX (2009)
Opensource with support of JavaFX 1.2 (2009)
Developed in close-source for 1.3 since then
Jemmy usages
●V2 (Swing/AWT)
● Internal: Swing, NetBeans, Glassfish
● External:
● Used by: Boeing (x2), agfa.com, compuware.com, attix5.com,
exgate.tek.com, globo.com, gmx.de, non.agilent.com
● Evaluated by: syntelinc.com, covast.com, visus-tt.com,
covast.com, nokia.com, twt.com, ubs.com
●V3 (FX)
● Internal: JavaFX, Authoring Tool, JavaStore
Demo...
Finally!
Jemmy v3JavaFX
AWT/Swing
SWT
Scenegraph
LCDUI
JemmyCore
Interfaces
AWT robot FX robot
Hierarchy
Input
Scene, node
containers
Scroller, slider,
list, text, ...
Generic
interfaces
Covered in this presentation
UI test
Find Do VerifyPass Pass
Pass
Fail Fail Fail
Failure analysis
Find next control
To perform operation
On in
Verify that expected
State reached
Perform necessary
actions
Lookup
● By ID
● Easiest but may not be possible
● «open_file_btn»
● By type
● Most common
● Button, text, combo box, etc
● By index
● Unavoidable
●
2nd
button with text «browse»
● By toString()
● Sucks
● projectmanager.Main$Main
$Script$1Scene$ObjLit$20
@4d16318b
● By text, tooltip,
associated label
● Best, if possible
● Button with text «browse»
UIcouldbe
verycomplicated
UIcouldbe
verycomplicated
UIcouldbe
verycomplicated
Lookup demo
Interfaces
Interface Control types Description
Mouse,
Keyboard,
Drag
Enything Low level input
Parent Containers, list (for its content) Something you could look within
Selectable Toggle button, radio button,
combobox, check box, lists, etc
A control which provides limited
number of choices
CaretOwner Text box, scroll bar, slider A control which has a number
value which changes within some
range
Text Text box Editable text container
Interfaces demo
Verifications
UI feedback Non UI feedback
Dialog displayed
Test changed
Image updated
Progress bar changed position
File created
Database updated
Sunset happened :)
Waiting
●UI is a multy-thread environment
Things happen in background
Test code is in another thread
●Not much could be really verified
●Everything should be waited for
Verification demo
Test automation
effectiveness
TD + *TS
NR
TM * NR
NC*
EA =
NC
*
EA
– automation effectiveness
NR
and NC
are characteristics for a product.
TM
is a characteristic of a test suite
TD
and TS
depend on test automation approach
Smaller TD
and TS
- higher the EA
.
1 2 3 4 5 6 7 8
0
5
10
15
20
25
0
1
2
3
4
Nc = 1 Ratio
Auto Manual Effect
Time
1 2 3 4 5 6 7 8
0
5
10
15
20
25
0
1
2
3
4
Nc = 3 Ratio
Auto Manual Effect
Time
Assumptions: TM
= 1 engineer*week TS
= 0.1 * TM
TD
= 5 * TM
NR
= 8
Td
or Ts
– what to minimize
TS
- if (NC
* NR
) is big
Multi-platform
Compatibility with external products (servers, browsers, ...)
Long-living
TD
- if (NC
* NR
) is small
Proof of concept
Preview
Tests fail every now and then ...
… because the tested UI is changed
Tests fail every now and then ...
Ah! And also because errors are made ...
End2End demo
Ts
continuends
Time spent on What to do %% of time
Allocating failures Use test harness 1% - 5%
Anderstandint the
failure reason
Use test logging, save
images, save UI state
10% - 80%
Fix the tests Move common code to
the library (*)
90% - 10%
(*) The only way it is different from programming is that there are a lot of tests.
More on this later.
Harness
TestNGTestNG
Understanding failure
Logging
UI operations
Going to push ... button
Selecting ... menu
UI responces
Found list view: …
UI hierarchy
Scene «…»
Group «…»
Button «…»
UI states
Images
Demo
Jemmy logging functionality
Fix the tests
One UI, many-many tests.
Do as few test code changes as possible
Ideally … one change in test code for one
change in UI code.
Decrease maintenance cost
●Implement reusable operations in a library
openFile(String filename)
●Decrease implementation dependencies
lookup(Button.class, new ByText<Button>(«Low»))
●Increasing stability
.wrap(0).mouse().click();
Thread.sleep(1000);
...
Demo
Refining test.
Library design approaches
Remember the formula?
TD
+ *TS
NR
TM
* NR
NC
*
EA
=
NC
*
EA
– automation effectiveness
To be used for every particular product.
NR
and NC
are unique for a product.
TM
is a characteristic of a test suite.
Smaller TD
and TS
- higher the EA
.
Coefficient depend on the way you write your tests
TS
mainly consists of time for test modification.
When product changes, tests need to be changed accordingly.
Many tests! Hundreds.
“Less changes of test code per a change in the product UI.”
Ideally ... no more than one.
But ... how? You are the coders – you know:
Move code to test library.
Application domain modelCarrecordCarrecordCarrecord
ColorColor
ModelModel MakeMake
YearYear License plateLicense plate
VINVIN
......
That's ... car catalog of some sort
Application UI
Product UIProduct UI
Coordinates
● click(134,32) //selects some record
● click(215,122) //hits “Properties”
● sleep(5) //sleeps to let dialog be painted
● click(64,182) //expands color combo
● click(235,182) //selects Gray
● click(235,212) //hit OK
TTdd
~= 1.1 * T~= 1.1 * Tmm
,, TTss
~= 1 * T~= 1 * TmmNever tried, but ...
Widgets
● Find “Car records” frame
● Find table
● Select “1abc234” cell
● Push “Properties” button
● Wait for “1abc234” dialog
● Select “Gray” color in combo box
● Push “OK”
ProductUIProductUIDomain
model
Domain
model
Car record
ColorColorModelModel
MakeMake YearYear License plateLicense plateVINVIN
Test
Widgets or coordinates
TTDD
~= 3 * T~= 3 * TMM
,, TTSS
~= .5 * T~= .5 * TMM
UI Primitives● Find car list frame
CarListFrame list = new CarListFrame()
● Open properties dialog for car “1abc234”
CarDialog propDialog =
list.carProperties(“1abc234”);
● Set color to gray
propDialog.setColor(Color.GRAY);
● Apply changes
propDialog.ok();
ProductUIProductUIDomain
model
Domain
model
Car record
Test libraryTest library
Color
Color
Model
Model
Make
Make
Year
Year
License plate
License plate
VIN
VIN
CarListFrame CarDialog
Test
TTDD
~= 5 * T~= 5 * TMM
,, TTSS
~= .2 * T~= .2 * TMM
Domain model
● Set col or t o gr ay f or a car
“ 1abc234”
new Car Recor d( “ 1abc234” ) .
set Col or ( Col or . GRAY) ;
Underneath the cover, CarRecord class does
all described earlier
Product
UI
Product
UI
Domain
model
Domain
model
Car record
Domain test libraryDomain test library
Color
Color
Model
Model
Make
Make
Year
Year
License plate
License plate
VIN
VIN
UI test libraryUI test libraryCarList CarDialog
CarRecord
Test
TTDD
~= 7.5 * T~= 7.5 * TMM
,, TTSS
~= .05 * T~= .05 * TMM
Coordinates Widgets UI Library Domain library
0
1
2
3
4
5
6
7
8
1.1
3
5
7.5
1
0.5
0.1 0.05
Td/Tm
Ts/Tm
Td
and Ts
together
Coordinates Widgets UI Library Domain library
0
5
10
15
20
25
30
1.1
3
5
7.5
24
12
2.4
1.2
25.1
15
7.4
8.7
Td
Ts
Td+(Ts*Nc*Nr)
TD
and TS
for NC
=3, NR
=8, TM
=1
EA
for NC
=3, NR
=8
Coordinates Widgets UI Library Domain library
0
0.5
1
1.5
2
2.5
3
3.5
0.96
1.6
3.24
2.76
Ea
Олег Бунин
Testing JavaFX UI
Tips from JavaFX quality team
Alexandre (Shura) Iline
Java and JavaFX quality architect
Oracle
Links
●http://jemmy.dev.java.net

Más contenido relacionado

La actualidad más candente

Hack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programingHack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programingunihack
 
UI Automation_White_CodedUI common problems and tricks
UI Automation_White_CodedUI common problems and tricksUI Automation_White_CodedUI common problems and tricks
UI Automation_White_CodedUI common problems and tricksTsimafei Avilin
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitweili_at_slideshare
 
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...Thomas Weller
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit testEugenio Lentini
 
Testing Options in Java
Testing Options in JavaTesting Options in Java
Testing Options in JavaMichael Fons
 
Chapt 6 game testing and publishing
Chapt 6   game testing and publishingChapt 6   game testing and publishing
Chapt 6 game testing and publishingMuhd Basheer
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox testsKevin Beeman
 
Coded ui - lesson 1 - overview
Coded ui - lesson 1 - overviewCoded ui - lesson 1 - overview
Coded ui - lesson 1 - overviewOmer Karpas
 
Introduction to unit testing in python
Introduction to unit testing in pythonIntroduction to unit testing in python
Introduction to unit testing in pythonAnirudh
 
UI Testing with Spec
 UI Testing with Spec UI Testing with Spec
UI Testing with SpecESUG
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Jacinto Limjap
 

La actualidad más candente (17)

Hack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programingHack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programing
 
UI Automation_White_CodedUI common problems and tricks
UI Automation_White_CodedUI common problems and tricksUI Automation_White_CodedUI common problems and tricks
UI Automation_White_CodedUI common problems and tricks
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnit
 
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
 
PowerShell UIAtomation
PowerShell UIAtomationPowerShell UIAtomation
PowerShell UIAtomation
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit test
 
Qtp basics
Qtp basicsQtp basics
Qtp basics
 
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
 
Testing Options in Java
Testing Options in JavaTesting Options in Java
Testing Options in Java
 
Chapt 6 game testing and publishing
Chapt 6   game testing and publishingChapt 6   game testing and publishing
Chapt 6 game testing and publishing
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
 
Coded ui - lesson 1 - overview
Coded ui - lesson 1 - overviewCoded ui - lesson 1 - overview
Coded ui - lesson 1 - overview
 
Introduction to unit testing in python
Introduction to unit testing in pythonIntroduction to unit testing in python
Introduction to unit testing in python
 
UI Testing with Spec
 UI Testing with Spec UI Testing with Spec
UI Testing with Spec
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Coded ui test
Coded ui testCoded ui test
Coded ui test
 

Destacado

Andrew Pantyukhin P Nf Sv4
Andrew Pantyukhin P Nf Sv4Andrew Pantyukhin P Nf Sv4
Andrew Pantyukhin P Nf Sv4guest092df8
 
Windows Azure Acid Test
Windows Azure Acid TestWindows Azure Acid Test
Windows Azure Acid Testexpanz
 
Speed Reading Benefits
Speed Reading BenefitsSpeed Reading Benefits
Speed Reading BenefitsWERBIZ
 
Alexander Shigin Slides
Alexander Shigin SlidesAlexander Shigin Slides
Alexander Shigin Slidesguest092df8
 
Vladimir Bobrikov Rit2010 Reputation
Vladimir Bobrikov Rit2010 ReputationVladimir Bobrikov Rit2010 Reputation
Vladimir Bobrikov Rit2010 Reputationguest092df8
 
Serge P Nekoval Grails
Serge P  Nekoval  GrailsSerge P  Nekoval  Grails
Serge P Nekoval Grailsguest092df8
 
Eugene Lisitsky Web Sockets
Eugene Lisitsky Web SocketsEugene Lisitsky Web Sockets
Eugene Lisitsky Web Socketsguest092df8
 
Denis Samoseev Risk Management
Denis Samoseev Risk ManagementDenis Samoseev Risk Management
Denis Samoseev Risk Managementguest092df8
 
Alexander Krizhanovsky Krizhanovsky Hpds
Alexander Krizhanovsky Krizhanovsky HpdsAlexander Krizhanovsky Krizhanovsky Hpds
Alexander Krizhanovsky Krizhanovsky Hpdsguest092df8
 
Max Lapshin Erlyvideo V1
Max Lapshin Erlyvideo V1Max Lapshin Erlyvideo V1
Max Lapshin Erlyvideo V1guest092df8
 
Andrew Shitov Rakudo Jonathan
Andrew Shitov Rakudo JonathanAndrew Shitov Rakudo Jonathan
Andrew Shitov Rakudo Jonathanguest092df8
 
Cac nha vat ly noi tieng
Cac nha vat ly noi tiengCac nha vat ly noi tieng
Cac nha vat ly noi tiengngphuoc2201
 
Artem Volftrub анатомия интернет банка
Artem Volftrub анатомия интернет банкаArtem Volftrub анатомия интернет банка
Artem Volftrub анатомия интернет банкаguest092df8
 

Destacado (19)

Catálogo 2012
Catálogo 2012Catálogo 2012
Catálogo 2012
 
TURANDOT
TURANDOTTURANDOT
TURANDOT
 
Andrew Pantyukhin P Nf Sv4
Andrew Pantyukhin P Nf Sv4Andrew Pantyukhin P Nf Sv4
Andrew Pantyukhin P Nf Sv4
 
Iva parte ii
Iva parte iiIva parte ii
Iva parte ii
 
Windows Azure Acid Test
Windows Azure Acid TestWindows Azure Acid Test
Windows Azure Acid Test
 
Speed Reading Benefits
Speed Reading BenefitsSpeed Reading Benefits
Speed Reading Benefits
 
Iva parte ii
Iva parte iiIva parte ii
Iva parte ii
 
Brain Science
Brain ScienceBrain Science
Brain Science
 
The Merchant Of Venice
The Merchant Of VeniceThe Merchant Of Venice
The Merchant Of Venice
 
Alexander Shigin Slides
Alexander Shigin SlidesAlexander Shigin Slides
Alexander Shigin Slides
 
Vladimir Bobrikov Rit2010 Reputation
Vladimir Bobrikov Rit2010 ReputationVladimir Bobrikov Rit2010 Reputation
Vladimir Bobrikov Rit2010 Reputation
 
Serge P Nekoval Grails
Serge P  Nekoval  GrailsSerge P  Nekoval  Grails
Serge P Nekoval Grails
 
Eugene Lisitsky Web Sockets
Eugene Lisitsky Web SocketsEugene Lisitsky Web Sockets
Eugene Lisitsky Web Sockets
 
Denis Samoseev Risk Management
Denis Samoseev Risk ManagementDenis Samoseev Risk Management
Denis Samoseev Risk Management
 
Alexander Krizhanovsky Krizhanovsky Hpds
Alexander Krizhanovsky Krizhanovsky HpdsAlexander Krizhanovsky Krizhanovsky Hpds
Alexander Krizhanovsky Krizhanovsky Hpds
 
Max Lapshin Erlyvideo V1
Max Lapshin Erlyvideo V1Max Lapshin Erlyvideo V1
Max Lapshin Erlyvideo V1
 
Andrew Shitov Rakudo Jonathan
Andrew Shitov Rakudo JonathanAndrew Shitov Rakudo Jonathan
Andrew Shitov Rakudo Jonathan
 
Cac nha vat ly noi tieng
Cac nha vat ly noi tiengCac nha vat ly noi tieng
Cac nha vat ly noi tieng
 
Artem Volftrub анатомия интернет банка
Artem Volftrub анатомия интернет банкаArtem Volftrub анатомия интернет банка
Artem Volftrub анатомия интернет банка
 

Similar a Alexandre Iline Rit 2010 Java Fxui

Alexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extraAlexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extrarit2010
 
Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxuirit2010
 
Automating JFC UI application testing with Jemmy
Automating JFC UI application testing with JemmyAutomating JFC UI application testing with Jemmy
Automating JFC UI application testing with JemmySPB SQA Group
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkPeter Kofler
 
Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...
Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...
Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...MobileMonday Estonia
 
ATDD Using Robot Framework
ATDD Using Robot FrameworkATDD Using Robot Framework
ATDD Using Robot FrameworkPekka Klärck
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI TestingShai Raiten
 
Katalon Studio - A Codeless Automation Tool.pdf
Katalon Studio - A Codeless Automation Tool.pdfKatalon Studio - A Codeless Automation Tool.pdf
Katalon Studio - A Codeless Automation Tool.pdfKnoldus Inc.
 
Fight back android fragmentation
Fight back android fragmentationFight back android fragmentation
Fight back android fragmentationBitbar
 
Exploring No Mans Land with Keyword-Driven Testing
Exploring No Mans Land with Keyword-Driven TestingExploring No Mans Land with Keyword-Driven Testing
Exploring No Mans Land with Keyword-Driven TestingMartinGijsen
 
Reliable mobile test automation
Reliable mobile test automationReliable mobile test automation
Reliable mobile test automationVishal Banthia
 
Top Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowTop Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowKathy Brown
 
Behaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About TestingBehaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About Testingdn
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsAbhijeet Vaikar
 
Performance & dev tools
Performance & dev toolsPerformance & dev tools
Performance & dev toolsGuy Yogev
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and TechniquesBala Subra
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging TechniquesBala Subra
 

Similar a Alexandre Iline Rit 2010 Java Fxui (20)

Alexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extraAlexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extra
 
Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxui
 
Automating JFC UI application testing with Jemmy
Automating JFC UI application testing with JemmyAutomating JFC UI application testing with Jemmy
Automating JFC UI application testing with Jemmy
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
Automation for developers
Automation for developersAutomation for developers
Automation for developers
 
Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...
Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...
Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...
 
ATDD Using Robot Framework
ATDD Using Robot FrameworkATDD Using Robot Framework
ATDD Using Robot Framework
 
Quality for developers
Quality for developersQuality for developers
Quality for developers
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
Katalon Studio - A Codeless Automation Tool.pdf
Katalon Studio - A Codeless Automation Tool.pdfKatalon Studio - A Codeless Automation Tool.pdf
Katalon Studio - A Codeless Automation Tool.pdf
 
Fight back android fragmentation
Fight back android fragmentationFight back android fragmentation
Fight back android fragmentation
 
Exploring No Mans Land with Keyword-Driven Testing
Exploring No Mans Land with Keyword-Driven TestingExploring No Mans Land with Keyword-Driven Testing
Exploring No Mans Land with Keyword-Driven Testing
 
Reliable mobile test automation
Reliable mobile test automationReliable mobile test automation
Reliable mobile test automation
 
Top Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowTop Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To Know
 
Gatling
GatlingGatling
Gatling
 
Behaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About TestingBehaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About Testing
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
Performance & dev tools
Performance & dev toolsPerformance & dev tools
Performance & dev tools
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
 

Alexandre Iline Rit 2010 Java Fxui

  • 1. Олег Бунин Testing JavaFX UI Tips from JavaFX quality team Alexandre (Shura) Iline Java and JavaFX quality architect Oracle
  • 2. Agenda ●UI testing overview ●Test automation approaches ●Jemmy library ●Test automation effectiveness ●Test library design approaches
  • 3. UI testing … by Wikipedia «GUI software testing is the process of testing a product that uses a graphical user interface, to ensure it meets its written specifications.»
  • 4. UI testing … most often ... «Checking whether usage of a product UI leads to results expected by the the person who performs testing»
  • 5. ●Start text editor ●Push «File/Open» ●Verify file chooser directory ●Select some file ●Verify editor area content ●Verify application title ●Verify buttons availabilities ●....
  • 6. UI Testing Manual Automated Initial step Design test specification. Create tests. Establish regular runs. Ongoing Click, click, click Analize results File bugs Change the specification Change the tests Qualification High, low for test executors High Effectiveness Low High Other Inexpensive to start Continuous quality monitoring , inexpensive to reuse Fun Bo-o-o-ring Much like programming
  • 8. Continuous build with testing Commit Build Success Testing Is it working? Passed Analysis. Rollback!!! Code changes Test changes No No Test further Build is good Code line is healthy Go on ... Yes Yes. = Compilation successful
  • 9. Automation approach Record && Replay Coding Test creation Inexpensive* Usually just repeating manual test in special environment Must be accompanied by other means Expensive* Consists of programming Test execution Does not depend on approach Test maintanance Higher (in most cases)* Very much depends on test format Lower* Depends on principles of building test library Test analysis Does not depend on approach (*) Much more information closer to the end of this presentation
  • 10. Jemmy
  • 11. Jemmy v2 Started as a tool to tests TeamWare UI (1999) Used for NetBeans extensions (2000) Official test tool for NetBeans (2001) Open-source (2001) Jemmy v3 Started in (2008) as a proof of concept experiemnt Extended to support JavaFX (2009) Opensource with support of JavaFX 1.2 (2009) Developed in close-source for 1.3 since then
  • 12. Jemmy usages ●V2 (Swing/AWT) ● Internal: Swing, NetBeans, Glassfish ● External: ● Used by: Boeing (x2), agfa.com, compuware.com, attix5.com, exgate.tek.com, globo.com, gmx.de, non.agilent.com ● Evaluated by: syntelinc.com, covast.com, visus-tt.com, covast.com, nokia.com, twt.com, ubs.com ●V3 (FX) ● Internal: JavaFX, Authoring Tool, JavaStore
  • 14. Jemmy v3JavaFX AWT/Swing SWT Scenegraph LCDUI JemmyCore Interfaces AWT robot FX robot Hierarchy Input Scene, node containers Scroller, slider, list, text, ... Generic interfaces Covered in this presentation
  • 15. UI test Find Do VerifyPass Pass Pass Fail Fail Fail Failure analysis Find next control To perform operation On in Verify that expected State reached Perform necessary actions
  • 16. Lookup ● By ID ● Easiest but may not be possible ● «open_file_btn» ● By type ● Most common ● Button, text, combo box, etc ● By index ● Unavoidable ● 2nd button with text «browse» ● By toString() ● Sucks ● projectmanager.Main$Main $Script$1Scene$ObjLit$20 @4d16318b ● By text, tooltip, associated label ● Best, if possible ● Button with text «browse»
  • 21. Interfaces Interface Control types Description Mouse, Keyboard, Drag Enything Low level input Parent Containers, list (for its content) Something you could look within Selectable Toggle button, radio button, combobox, check box, lists, etc A control which provides limited number of choices CaretOwner Text box, scroll bar, slider A control which has a number value which changes within some range Text Text box Editable text container
  • 23. Verifications UI feedback Non UI feedback Dialog displayed Test changed Image updated Progress bar changed position File created Database updated Sunset happened :)
  • 24. Waiting ●UI is a multy-thread environment Things happen in background Test code is in another thread ●Not much could be really verified ●Everything should be waited for
  • 27. TD + *TS NR TM * NR NC* EA = NC * EA – automation effectiveness NR and NC are characteristics for a product. TM is a characteristic of a test suite TD and TS depend on test automation approach Smaller TD and TS - higher the EA .
  • 28. 1 2 3 4 5 6 7 8 0 5 10 15 20 25 0 1 2 3 4 Nc = 1 Ratio Auto Manual Effect Time 1 2 3 4 5 6 7 8 0 5 10 15 20 25 0 1 2 3 4 Nc = 3 Ratio Auto Manual Effect Time Assumptions: TM = 1 engineer*week TS = 0.1 * TM TD = 5 * TM NR = 8
  • 29. Td or Ts – what to minimize TS - if (NC * NR ) is big Multi-platform Compatibility with external products (servers, browsers, ...) Long-living TD - if (NC * NR ) is small Proof of concept Preview
  • 30. Tests fail every now and then ... … because the tested UI is changed
  • 31. Tests fail every now and then ... Ah! And also because errors are made ...
  • 33. Ts continuends Time spent on What to do %% of time Allocating failures Use test harness 1% - 5% Anderstandint the failure reason Use test logging, save images, save UI state 10% - 80% Fix the tests Move common code to the library (*) 90% - 10% (*) The only way it is different from programming is that there are a lot of tests. More on this later.
  • 35. Understanding failure Logging UI operations Going to push ... button Selecting ... menu UI responces Found list view: … UI hierarchy Scene «…» Group «…» Button «…» UI states Images
  • 37. Fix the tests One UI, many-many tests. Do as few test code changes as possible Ideally … one change in test code for one change in UI code.
  • 38. Decrease maintenance cost ●Implement reusable operations in a library openFile(String filename) ●Decrease implementation dependencies lookup(Button.class, new ByText<Button>(«Low»)) ●Increasing stability .wrap(0).mouse().click(); Thread.sleep(1000); ...
  • 41. Remember the formula? TD + *TS NR TM * NR NC * EA = NC * EA – automation effectiveness To be used for every particular product. NR and NC are unique for a product. TM is a characteristic of a test suite. Smaller TD and TS - higher the EA . Coefficient depend on the way you write your tests
  • 42. TS mainly consists of time for test modification. When product changes, tests need to be changed accordingly. Many tests! Hundreds. “Less changes of test code per a change in the product UI.” Ideally ... no more than one. But ... how? You are the coders – you know: Move code to test library.
  • 43. Application domain modelCarrecordCarrecordCarrecord ColorColor ModelModel MakeMake YearYear License plateLicense plate VINVIN ...... That's ... car catalog of some sort
  • 45. Coordinates ● click(134,32) //selects some record ● click(215,122) //hits “Properties” ● sleep(5) //sleeps to let dialog be painted ● click(64,182) //expands color combo ● click(235,182) //selects Gray ● click(235,212) //hit OK TTdd ~= 1.1 * T~= 1.1 * Tmm ,, TTss ~= 1 * T~= 1 * TmmNever tried, but ...
  • 46. Widgets ● Find “Car records” frame ● Find table ● Select “1abc234” cell ● Push “Properties” button ● Wait for “1abc234” dialog ● Select “Gray” color in combo box ● Push “OK”
  • 47. ProductUIProductUIDomain model Domain model Car record ColorColorModelModel MakeMake YearYear License plateLicense plateVINVIN Test Widgets or coordinates TTDD ~= 3 * T~= 3 * TMM ,, TTSS ~= .5 * T~= .5 * TMM
  • 48. UI Primitives● Find car list frame CarListFrame list = new CarListFrame() ● Open properties dialog for car “1abc234” CarDialog propDialog = list.carProperties(“1abc234”); ● Set color to gray propDialog.setColor(Color.GRAY); ● Apply changes propDialog.ok();
  • 49. ProductUIProductUIDomain model Domain model Car record Test libraryTest library Color Color Model Model Make Make Year Year License plate License plate VIN VIN CarListFrame CarDialog Test TTDD ~= 5 * T~= 5 * TMM ,, TTSS ~= .2 * T~= .2 * TMM
  • 50. Domain model ● Set col or t o gr ay f or a car “ 1abc234” new Car Recor d( “ 1abc234” ) . set Col or ( Col or . GRAY) ; Underneath the cover, CarRecord class does all described earlier
  • 51. Product UI Product UI Domain model Domain model Car record Domain test libraryDomain test library Color Color Model Model Make Make Year Year License plate License plate VIN VIN UI test libraryUI test libraryCarList CarDialog CarRecord Test TTDD ~= 7.5 * T~= 7.5 * TMM ,, TTSS ~= .05 * T~= .05 * TMM
  • 52. Coordinates Widgets UI Library Domain library 0 1 2 3 4 5 6 7 8 1.1 3 5 7.5 1 0.5 0.1 0.05 Td/Tm Ts/Tm Td and Ts together
  • 53. Coordinates Widgets UI Library Domain library 0 5 10 15 20 25 30 1.1 3 5 7.5 24 12 2.4 1.2 25.1 15 7.4 8.7 Td Ts Td+(Ts*Nc*Nr) TD and TS for NC =3, NR =8, TM =1
  • 54. EA for NC =3, NR =8 Coordinates Widgets UI Library Domain library 0 0.5 1 1.5 2 2.5 3 3.5 0.96 1.6 3.24 2.76 Ea
  • 55. Олег Бунин Testing JavaFX UI Tips from JavaFX quality team Alexandre (Shura) Iline Java and JavaFX quality architect Oracle

Notas del editor

  1. Note that in reality all the verifications should be done throwg waiting
  2. Effectiveness is estimated under assumtion that the testing is thoruogh and there are many tests
  3. This is a well accepeted practice nowadays. However it is not really possible without testing. And it is not really possible with manual testing as the turnaround is too long to rely on.
  4. This is a well accepeted practice nowadays. However it is not really possible without testing. And it is not really possible with manual testing as the turnaround is too long to rely on.
  5. If we get to it, I will be howing figures which explain why do we think so
  6. It is not a toy
  7. ditto
  8. The values of course depend on how the fast product is changing The estimations are for NetBeans – we went throughthis stage Now would happen if the combobox is replaced by color chooser page up test would fail, &amp;apos;cause it&amp;apos;s looking for combobox page down Most importantly ... all tests would fail!
  9. Obvious solution