SlideShare a Scribd company logo
1 of 25
Test Automation with Twist and Sahi
May 2014
Mattersight Corporation
1
Eric Blackburn, Chris Stanush, Peter Zejda
Agenda
2
• Why
• Sahi
• Sahi vs Selenium
• Twist
• Design Suggestions
• Demo Video
• Questions
Save Questions Till The End
3
• We will stick around
Agenda
4
• Why
• Sahi
• Sahi vs Selenium
• Twist
• Design Suggestions
• Demo Video
• Questions
Why
5
• Functional Test Automation – hard
• GUI Functional Test Automation - especially hard
− DOM changes occur often
− Complex HTML controls
− Support multiple browsers
− Record and playback is fragile – doesn’t support change
− Need for separating the “What” from the “How”
• Intent (the “What”) doesn’t change as often as the testing method
(the “How”)
• Business side needs to write/maintain scenarios, not developers
• Automated testing needs to be faster than manual
• Testing tools can be expensive
• Need ability to “check in” / version Test Cases with code
• Need a full language and enterprise software architecture / design to
create an effective test framework (and make part of ConDel)
Agenda
6
• Why
• Sahi
• Sahi vs Selenium
• Twist
• Design Suggestions
• Demo Video
• Questions
What is Sahi
• Sahi is the proxy between Java and the Browser
− Java -> Sahi -> Javascript -> Browser
− Java <- Sahi <- Javascript <- Browser
• Learn more about Sahi: http://sahi.co.in/
7
Agenda
8
• Why
• Sahi
• Sahi vs Selenium
• Twist
• Design Suggestions
• Demo Video
• Questions
Sahi vs Selenium
• Selenium
− Positives
• Run JavaScript directly against the browser
• Widely used
• Different flavors
− Selenium 2.0
− Geb
− Helium
− Negatives
• Lack of auto-waits for Ajax calls
− http://www.thoughtworks.com/products/docs/twist/current/help/how_
do_i_handle_ajax_in_selenium2.html
• Wait for driver updates
• For built in functions, different experiences with different drivers.
• Sahi
− Positives
• Run JavaScript directly against the browser
• Automatically waits for page to load and for any Ajax calls to finish
• For built in functions, same experience for all browsers.
• Supports concurrent testing (batch runs)
− Negatives
• Sometimes proxy doesn’t initiate properly.
9
Agenda
10
• Why
• Sahi
• Sahi vs Selenium
• Twist
• Design Suggestions
• Demo Video
• Questions
Twist http://www.thoughtworks.com/products/twist-agile-testing
• BDD interface built into Eclipse
• Cost
− $100 a year per developer
• Free updates
− Able to export libraries and run on test harness
systems/servers for free, as many test harness servers as
desired.
11
Twist - Behavior-driven Development BDD [1]
• Domain Specific Language (DSL)
• Business can write tests
− Non-formal English
− Specify intent
− Abstracted step from how it is implemented
• Code changes, but the sentence (intent) remains the same.
− Prior to code being implemented
• BDT
12
[1] http://en.wikipedia.org/wiki/Behavior-driven_development
Twist
• GUI and Non-GUI functional testing
• Contexts
− Setup and Teardown steps always run, when added to a scenario
• Tags
− Used to organize scenarios
− “Not IE7”, “Disabled”, “Active”
• Steps from multiple Classes
• Comments
• Manual steps
• Table driven steps
• No browser focus needed
• Auto snapshots for failures
• Auto generated HTML result reports
• Jenkins slave runs tests via ANT or Maven
− Windows needs VNC service running (browser needs GUI
rendering). Real VNC free edition works fine.
− Reportedly Linux can run headless
13
Twist
• Table driven steps
−Can fail sections of the table using Asserts
• Run results as HTML Report
• More info about how to use various features is available at
− http://www.thoughtworks.com/products/docs/twist/current/help/whats_new.html
14
Agenda
15
• Why
• Sahi
• Sahi vs Selenium
• Twist
• Design Suggestions
• Demo Video
• Questions
Design Suggestions – Browser Adapter
• Problem
− Dependency on the web interaction
tool (Sahi)
• Solution
− Abstract browser interaction
• Portability
• Identify elements via JavaScript
chaining (pass around strings)
− Browser Adapter class
• All of code inherits added or changed
classes
• Doesn’t help when a class is removed
− Create own API
• Not a big deal
− 15 methods for Action
− 7 methods for State
• Better API than original
16
Design Suggestions – Control Object Pattern
• Problem
− Many web controls
• Each with specialized find, set and
verify functionality
− Control interfaces can be very
complicated
− Control interfaces do change
• Solution
− Follow the “Information Expert”
design pattern[1]
• Encapsulate logic for
− Find and Set methods
− Verify state of control
17
[1] http://en.wikipedia.org/wiki/GRASP_(object-oriented_design)#Information_Expert
Design Suggestions – Pre-build JavaScript/jQuery
• Problem
− Calls to the browser are
slow
• Solution
− Move logic into JavaScript
• Browser is able to process
complex logic fast
• Sometimes the algorithm
needs to be next to the
data
18
Design Suggestions – Jsoup http://jsoup.org/
• Problem
− Need for complex inspection of DOM and calls to the browser are
slow.
• Solution
− Use Jsoup to cache the DOM
• Return DOM content as a String and parse directly in code
• Complex processing of the DOM is fast
• Syntax is easy to use
19
Design Suggestions – Find Elements
• Problem
− Identify web content based on what the scenario writer can see
• Solution
− public String findNthVisibleElement(FieldTypeEnum fieldType, String
parentSelectorValue, String elementIdentifier, int index)
• A central function that is able to find elements. Elements can be identified by
their text content, id, name, aria-label, etc.
− Identify an element by passing around a String that can be used to scope
up and down
• Use JavaScript or jQuery syntax
20
Design Suggestions – Find Elements – Helper Methods
• List out what controls can exist as
• List out what identifies are used for each HTML
element type
21
Design Suggestions – Find Elements – Helper Methods
• Build comma delimited selector using the identifier and the
list of element types
− e.g. “#userinput, .userinput, [aria-label=‘userinput’]”
22
Design Suggestions – Find Elements – Helper Methods
• ContainsExact(Case) – Find element that only contains
• Problem - :Contains(‘some of text’) doesn’t work
• Matches both
− <span>some of text</span>
− <span>text and some of text and more text</span>
• Solution - :ContainsExact(Case)(‘some of text’) works
• Matches only
− <span>some of text</span>
23
Agenda
24
• Why
• Sahi
• Sahi vs Selenium
• Twist
• Design Suggestions
• Demo Video
• Questions
• Concerns, Ideas, Requests, Champagne?
Questions?

More Related Content

What's hot

UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing Automation
AgileEngine
 
Paper published on web application testing with sahi tool
Paper published on web application testing with sahi toolPaper published on web application testing with sahi tool
Paper published on web application testing with sahi tool
Lalit Choudhary
 
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Applitools
 

What's hot (20)

Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
 
Selenium Architecture
Selenium ArchitectureSelenium Architecture
Selenium Architecture
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor
 
Using protractor to build automated ui tests
Using protractor to build automated ui testsUsing protractor to build automated ui tests
Using protractor to build automated ui tests
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview Questions
 
Selenium Basics Tutorial
Selenium Basics TutorialSelenium Basics Tutorial
Selenium Basics Tutorial
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing Automation
 
Demystifying Selenium framework
Demystifying Selenium frameworkDemystifying Selenium framework
Demystifying Selenium framework
 
Paper published on web application testing with sahi tool
Paper published on web application testing with sahi toolPaper published on web application testing with sahi tool
Paper published on web application testing with sahi tool
 
Test automation - Building effective solutions
Test automation - Building effective solutionsTest automation - Building effective solutions
Test automation - Building effective solutions
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
 
Selenium drivers
Selenium driversSelenium drivers
Selenium drivers
 
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.ppt
 

Viewers also liked

Viewers also liked (9)

Web testing automation with sahi
Web testing automation with sahiWeb testing automation with sahi
Web testing automation with sahi
 
Sahi - Effective Web Testing
Sahi - Effective Web TestingSahi - Effective Web Testing
Sahi - Effective Web Testing
 
Sahi Principles and Architecture
Sahi Principles and ArchitectureSahi Principles and Architecture
Sahi Principles and Architecture
 
Automation With A Tool Demo
Automation With A Tool DemoAutomation With A Tool Demo
Automation With A Tool Demo
 
Sahi - Effective Web Testing (MT)
Sahi - Effective Web Testing (MT)Sahi - Effective Web Testing (MT)
Sahi - Effective Web Testing (MT)
 
Selenium presentation
Selenium presentationSelenium presentation
Selenium presentation
 
Rpt ppt
Rpt pptRpt ppt
Rpt ppt
 
Sahi my expirience
Sahi my expirienceSahi my expirience
Sahi my expirience
 
Sahi Web Automation and Testing Tool
Sahi Web Automation and Testing ToolSahi Web Automation and Testing Tool
Sahi Web Automation and Testing Tool
 

Similar to Test Automation with Twist and Sahi

August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
Howard Greenberg
 
Acing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointAcing application lifecycle management in SharePoint
Acing application lifecycle management in SharePoint
Jeremy Thake
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Jeremy Likness
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
dmethvin
 

Similar to Test Automation with Twist and Sahi (20)

Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
 
Untying the Knots of Web Dev with Internet Explorer
Untying the Knots of Web Dev with Internet Explorer Untying the Knots of Web Dev with Internet Explorer
Untying the Knots of Web Dev with Internet Explorer
 
Agile sites @ telmore
Agile sites @ telmore Agile sites @ telmore
Agile sites @ telmore
 
Automated Visual Regression Testing by Dave Sadlon
Automated Visual Regression Testing by Dave SadlonAutomated Visual Regression Testing by Dave Sadlon
Automated Visual Regression Testing by Dave Sadlon
 
Web Tools for GemStone/S
Web Tools for GemStone/SWeb Tools for GemStone/S
Web Tools for GemStone/S
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
 
Selenium for everyone
Selenium for everyoneSelenium for everyone
Selenium for everyone
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill Ayers
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
 
Acing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointAcing application lifecycle management in SharePoint
Acing application lifecycle management in SharePoint
 
How to build a JavaScript toolkit
How to build a JavaScript toolkitHow to build a JavaScript toolkit
How to build a JavaScript toolkit
 
Writing better code: How the Netbeans IDE Helps you Write, Test and Debug Java
Writing better code: How the Netbeans IDE Helps you Write, Test and Debug JavaWriting better code: How the Netbeans IDE Helps you Write, Test and Debug Java
Writing better code: How the Netbeans IDE Helps you Write, Test and Debug Java
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 
Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?
 
Pearls and Must-Have Tools for the Modern Web / .NET Developer
Pearls and Must-Have Tools for the Modern Web / .NET DeveloperPearls and Must-Have Tools for the Modern Web / .NET Developer
Pearls and Must-Have Tools for the Modern Web / .NET Developer
 
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
 

Recently uploaded

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 

Test Automation with Twist and Sahi

  • 1. Test Automation with Twist and Sahi May 2014 Mattersight Corporation 1 Eric Blackburn, Chris Stanush, Peter Zejda
  • 2. Agenda 2 • Why • Sahi • Sahi vs Selenium • Twist • Design Suggestions • Demo Video • Questions
  • 3. Save Questions Till The End 3 • We will stick around
  • 4. Agenda 4 • Why • Sahi • Sahi vs Selenium • Twist • Design Suggestions • Demo Video • Questions
  • 5. Why 5 • Functional Test Automation – hard • GUI Functional Test Automation - especially hard − DOM changes occur often − Complex HTML controls − Support multiple browsers − Record and playback is fragile – doesn’t support change − Need for separating the “What” from the “How” • Intent (the “What”) doesn’t change as often as the testing method (the “How”) • Business side needs to write/maintain scenarios, not developers • Automated testing needs to be faster than manual • Testing tools can be expensive • Need ability to “check in” / version Test Cases with code • Need a full language and enterprise software architecture / design to create an effective test framework (and make part of ConDel)
  • 6. Agenda 6 • Why • Sahi • Sahi vs Selenium • Twist • Design Suggestions • Demo Video • Questions
  • 7. What is Sahi • Sahi is the proxy between Java and the Browser − Java -> Sahi -> Javascript -> Browser − Java <- Sahi <- Javascript <- Browser • Learn more about Sahi: http://sahi.co.in/ 7
  • 8. Agenda 8 • Why • Sahi • Sahi vs Selenium • Twist • Design Suggestions • Demo Video • Questions
  • 9. Sahi vs Selenium • Selenium − Positives • Run JavaScript directly against the browser • Widely used • Different flavors − Selenium 2.0 − Geb − Helium − Negatives • Lack of auto-waits for Ajax calls − http://www.thoughtworks.com/products/docs/twist/current/help/how_ do_i_handle_ajax_in_selenium2.html • Wait for driver updates • For built in functions, different experiences with different drivers. • Sahi − Positives • Run JavaScript directly against the browser • Automatically waits for page to load and for any Ajax calls to finish • For built in functions, same experience for all browsers. • Supports concurrent testing (batch runs) − Negatives • Sometimes proxy doesn’t initiate properly. 9
  • 10. Agenda 10 • Why • Sahi • Sahi vs Selenium • Twist • Design Suggestions • Demo Video • Questions
  • 11. Twist http://www.thoughtworks.com/products/twist-agile-testing • BDD interface built into Eclipse • Cost − $100 a year per developer • Free updates − Able to export libraries and run on test harness systems/servers for free, as many test harness servers as desired. 11
  • 12. Twist - Behavior-driven Development BDD [1] • Domain Specific Language (DSL) • Business can write tests − Non-formal English − Specify intent − Abstracted step from how it is implemented • Code changes, but the sentence (intent) remains the same. − Prior to code being implemented • BDT 12 [1] http://en.wikipedia.org/wiki/Behavior-driven_development
  • 13. Twist • GUI and Non-GUI functional testing • Contexts − Setup and Teardown steps always run, when added to a scenario • Tags − Used to organize scenarios − “Not IE7”, “Disabled”, “Active” • Steps from multiple Classes • Comments • Manual steps • Table driven steps • No browser focus needed • Auto snapshots for failures • Auto generated HTML result reports • Jenkins slave runs tests via ANT or Maven − Windows needs VNC service running (browser needs GUI rendering). Real VNC free edition works fine. − Reportedly Linux can run headless 13
  • 14. Twist • Table driven steps −Can fail sections of the table using Asserts • Run results as HTML Report • More info about how to use various features is available at − http://www.thoughtworks.com/products/docs/twist/current/help/whats_new.html 14
  • 15. Agenda 15 • Why • Sahi • Sahi vs Selenium • Twist • Design Suggestions • Demo Video • Questions
  • 16. Design Suggestions – Browser Adapter • Problem − Dependency on the web interaction tool (Sahi) • Solution − Abstract browser interaction • Portability • Identify elements via JavaScript chaining (pass around strings) − Browser Adapter class • All of code inherits added or changed classes • Doesn’t help when a class is removed − Create own API • Not a big deal − 15 methods for Action − 7 methods for State • Better API than original 16
  • 17. Design Suggestions – Control Object Pattern • Problem − Many web controls • Each with specialized find, set and verify functionality − Control interfaces can be very complicated − Control interfaces do change • Solution − Follow the “Information Expert” design pattern[1] • Encapsulate logic for − Find and Set methods − Verify state of control 17 [1] http://en.wikipedia.org/wiki/GRASP_(object-oriented_design)#Information_Expert
  • 18. Design Suggestions – Pre-build JavaScript/jQuery • Problem − Calls to the browser are slow • Solution − Move logic into JavaScript • Browser is able to process complex logic fast • Sometimes the algorithm needs to be next to the data 18
  • 19. Design Suggestions – Jsoup http://jsoup.org/ • Problem − Need for complex inspection of DOM and calls to the browser are slow. • Solution − Use Jsoup to cache the DOM • Return DOM content as a String and parse directly in code • Complex processing of the DOM is fast • Syntax is easy to use 19
  • 20. Design Suggestions – Find Elements • Problem − Identify web content based on what the scenario writer can see • Solution − public String findNthVisibleElement(FieldTypeEnum fieldType, String parentSelectorValue, String elementIdentifier, int index) • A central function that is able to find elements. Elements can be identified by their text content, id, name, aria-label, etc. − Identify an element by passing around a String that can be used to scope up and down • Use JavaScript or jQuery syntax 20
  • 21. Design Suggestions – Find Elements – Helper Methods • List out what controls can exist as • List out what identifies are used for each HTML element type 21
  • 22. Design Suggestions – Find Elements – Helper Methods • Build comma delimited selector using the identifier and the list of element types − e.g. “#userinput, .userinput, [aria-label=‘userinput’]” 22
  • 23. Design Suggestions – Find Elements – Helper Methods • ContainsExact(Case) – Find element that only contains • Problem - :Contains(‘some of text’) doesn’t work • Matches both − <span>some of text</span> − <span>text and some of text and more text</span> • Solution - :ContainsExact(Case)(‘some of text’) works • Matches only − <span>some of text</span> 23
  • 24. Agenda 24 • Why • Sahi • Sahi vs Selenium • Twist • Design Suggestions • Demo Video • Questions
  • 25. • Concerns, Ideas, Requests, Champagne? Questions?