SlideShare a Scribd company logo
1 of 36
Download to read offline
Test Automation
& Selenium
Oren Rubin
CEO, Testim.io
Oren Rubin
● Why Unit Tests aren't enough?
● Writing Unit Tests !== Writing E2E Tests
● Meet Selenium
● Best practices & Design Patterns
● Selenium Grid
● UI Validations
● Record / Playback
Today's Menu
Selenium to UI-Testing is like..
Power Steering & Automatic Transmission is to Driving
I'm
not making you
coffee!
Unit Tests: Same language, Easy setup. Synchronous.
// Setup
Account account = new Account();
// Stimuli e.g. click, setting text, XHR
account.login( "borg", "resistance is futile" );
// Validation
assert( account.isLoggedIn(), true );
E2E vs. Unit - same same but different
E2E is
the real
SHIT!
● Synchronous?
● Same language?
● Easy setup?
○ Where are the browsers running?
○ Who's in charge of keeping them alive?
E2E is hard!
Expected: Actual:
Cowabunga
It gets worse.. I shit you not!
Cowabunga Cowabungaz-index
Cowabungasize
CowabungaThe Flying Pony
Cowabung
a
Over here!
Blur, Focus, ….
CSS
HTML
JS Event
One browser.. you wish!
* What about responsive design?!
Which language do you prefer?
Test Language?
Meet Selenium
Why the name Selenium?
Selenium 1 - JS based
Selenium 2 - WebDriver & WebElements
Selenium 3 - Mobile
Past, Present, and Future
Google Trends - Same for Jobs
Example - la login
// setup
WebDriver driver = new Chrome();
driver.get("http://www.google.com");
// stimuli
driver.findElement( By.id("user") ).sendKeys("mel brooks");
driver.findElement( By.id("password") ).sendKeys("12345");
driver.findElement( By.id("submit") ).submit();
// assertion
assert(driver.getTitle(), "That's the kind of thing an idiot would have on his luggage!");
// tear down
driver.quit();
Example
Architecture
?
Can anyone suggest a good architecture?
...
...
One (W3C) Standard to rule them all!
https://code.google.com/p/selenium/wiki/JsonWireProtocol http://www.w3.org/TR/webdriver/
HTTP as a universal language
?
The
Wire
Protocol
SDK Driver
Closer look
new Chrome(); chromedriver.exe
Browser
HTTP Request
localhost:4444/click
driver = new Chrome();
...
submitBtn.click();
driver
note: don't forget to frequently u
chromedriver.exe
Now for Firefox
new Firefox(); webdriver.xpi
Browser
HTTP Request
localhost:4444/click
driver
driver = new Firefox();
...
submitBtn.click();
Let's improve
loginChromeTest () {
driver = new Chrome();
loginTest(driver);
}
loginFirefoxTest () {
driver = new Firefox();
loginTest(driver);
}
loginTest (driver) {
driver.findElement( By.id("user") ).sendKeys("mel brooks");
driver.findElement( By.id("password") ).sendKeys("12345");
driver.findElement( By.id("submit") ).submit();
}
Page Objects
A Design Pattern.
Provides a programmatic API to drive and interrogate a UI
Best Practices & Design Patterns
http://www.slideshare.net/orenrubin/page-objects-presentation-selenium-conference-2014-38767492
// setup
WebDriver driver = new Chrome();
driver.get("http://www.google.com");
// stimuli
driver.findElement( By.id("user") ).sendKeys("mel brooks");
driver.findElement( By.id("password") ).sendKeys("12345");
driver.findElement( By.id("submit") ).submit();
// assertion
assert(driver.getTitle(), "That's the kind of thing an idiot would have on his luggage!");
// tear down
driver.quit();
Example
Simon
says no!
@Test
void loginTest () {
Test Automation Architecture
Link to "Page Objects Done Right" Presentation
Selenium Grid
● Concurrency
● Multiple
Platforms
Remember this?
new Chrome(); chromedriver.exe
Browser
HTTP Request
localhost:8989/click
driver = new Chrome();
...
submitBtn.click();
driver
What we want
new Chrome(); chromedriver.exe
Browser
HTTP Request
<some-ip>:8989/click
driver = new Chrome();
...
submitBtn.click();
driver
computer 1 computer 2
Selenium Grid
java -jar selenium.jar
-port 4444
-role hub
selenium hub
Node 0 on 10.0
Selenium Grid
Node 1 on 10.1
Node 2 on 10.2
selenium node
java -jar selenium.jar -role webdriver -browser firefox
-hubHost 10.0 –port 8989
java -jar selenium.jar
-port 4444
-role hub
selenium node
java -jar selenium.jar -role webdriver -browser chrome
-hubHost 10.0 –port 8989
selenium hub
Node 0 on 10.0
chromedriver.exe
firefox-webdriver.dpi
Selenium Grid
new Chrome();
Browser
HTTP Request
10.0:4444/chrome
hub = new URL("10.0:4444/wd/hub")
cap = new Capabilities ("chrome", "v3", "windows")
driver = new RemoteWebDriver( hub, cap );
...
driver
my computer / CI server
Node 1 on 10.1
Node 2 on 10.2
selenium node
java -jar selenium.jar -role webdriver
-hubHost 10.1 –port 8989
java -jar selenium.jar
-port 4444
-role hub
selenium node
java -jar selenium.jar -role webdriver
-hubHost 10.1 –port 8989
selenium hub
Node 0 on 10.0
HTTP Request
10.2:8989/chrome
chromedriver.exe
firefox-webdriver.dpi
Selenium Grid
new Chrome();
Browser
HTTP Request
10.0:4444/click
driver = ...
submitBtn = driver.find(By.id("submit"));
submitBtn.click();
driver
my computer / CI server
Node 1 on 10.1
Node 2 on 10.2
selenium node
java -jar selenium.jar -role webdriver
-hubHost 10.1 –port 8989
java -jar selenium.jar
-port 4444
-role hub
selenium node
java -jar selenium.jar -role webdriver
-hubHost 10.1 –port 8989
selenium hub
Node 0 on 10.0
HTTP Request
10.2:8989/click
chromedriver.exe
firefox-webdriver.dpi
Browsers in the cloud
Selenium Grid as a Service
SaaS Open source
Spot the differences
UI Verification - Applitools eye
One image is worth a 1000 assertions
Oren Rubin
Testim.io
oren@testim.io
Thank you!

More Related Content

What's hot

Angular UI Testing with Protractor
Angular UI Testing with ProtractorAngular UI Testing with Protractor
Angular UI Testing with ProtractorAndrew Eisenberg
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
 
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Iakiv Kramarenko
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and RubyYnon Perek
 
Real World Selenium Testing
Real World Selenium TestingReal World Selenium Testing
Real World Selenium TestingMary Jo Sminkey
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksAddy Osmani
 
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 2015Codemotion
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Andrew Eisenberg
 
Write Selenide in Python 15 min
Write Selenide in Python 15 minWrite Selenide in Python 15 min
Write Selenide in Python 15 minIakiv Kramarenko
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: DemystifiedSeth McLaughlin
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David TorroijaDavid Torroija
 
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Alan Richardson
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testingMats Bryntse
 
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptxDSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptxMikalai Alimenkou
 
Automated Testing With Watir
Automated Testing With WatirAutomated Testing With Watir
Automated Testing With WatirTimothy Fisher
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsLudmila Nesvitiy
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web ApplicationsSeth McLaughlin
 

What's hot (20)

Angular UI Testing with Protractor
Angular UI Testing with ProtractorAngular UI Testing with Protractor
Angular UI Testing with Protractor
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 
Real World Selenium Testing
Real World Selenium TestingReal World Selenium Testing
Real World Selenium Testing
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
 
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
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015
 
Write Selenide in Python 15 min
Write Selenide in Python 15 minWrite Selenide in Python 15 min
Write Selenide in Python 15 min
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David Torroija
 
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testing
 
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptxDSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
 
Automated Testing With Watir
Automated Testing With WatirAutomated Testing With Watir
Automated Testing With Watir
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
 

Viewers also liked

APIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsAPIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsSauce Labs
 
Perils of Page-Object Pattern
Perils of Page-Object PatternPerils of Page-Object Pattern
Perils of Page-Object PatternAnand Bagmar
 
Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Oren Rubin
 
Sharing (less) Pain of using Protractor & WebDriver
Sharing (less) Pain of using Protractor & WebDriverSharing (less) Pain of using Protractor & WebDriver
Sharing (less) Pain of using Protractor & WebDriverAnand Bagmar
 
Patterns in Test Automation
Patterns in Test AutomationPatterns in Test Automation
Patterns in Test AutomationAnand Bagmar
 

Viewers also liked (6)

APIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsAPIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page Objects
 
Perils of Page-Object Pattern
Perils of Page-Object PatternPerils of Page-Object Pattern
Perils of Page-Object Pattern
 
Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014
 
Sistema Hexadecimal
Sistema HexadecimalSistema Hexadecimal
Sistema Hexadecimal
 
Sharing (less) Pain of using Protractor & WebDriver
Sharing (less) Pain of using Protractor & WebDriverSharing (less) Pain of using Protractor & WebDriver
Sharing (less) Pain of using Protractor & WebDriver
 
Patterns in Test Automation
Patterns in Test AutomationPatterns in Test Automation
Patterns in Test Automation
 

Similar to Test automation & Seleniun by oren rubin

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
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnetVlad Maniak
 
前端網頁自動測試
前端網頁自動測試 前端網頁自動測試
前端網頁自動測試 政億 林
 
Selenide vs. Selenium: The War Of Technologies
Selenide vs. Selenium: The War Of TechnologiesSelenide vs. Selenium: The War Of Technologies
Selenide vs. Selenium: The War Of TechnologiesBugRaptors
 
Challenges in test automation for web apps
Challenges in test automation for web appsChallenges in test automation for web apps
Challenges in test automation for web appsSudara Fernando
 
探討Web ui自動化測試工具
探討Web ui自動化測試工具探討Web ui自動化測試工具
探討Web ui自動化測試工具政億 林
 
Automation Abstractions: Page Objects and Beyond
Automation Abstractions: Page Objects and BeyondAutomation Abstractions: Page Objects and Beyond
Automation Abstractions: Page Objects and BeyondTechWell
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaAgile Testing Alliance
 
Introduction to Selenium
Introduction to SeleniumIntroduction to Selenium
Introduction to Seleniumrohitnayak
 
Javascript testing should be awesome
Javascript testing should be awesomeJavascript testing should be awesome
Javascript testing should be awesomeAbderrazak BOUADMA
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.comtestingbot
 
Architecting test automation using selenium
Architecting test automation using seleniumArchitecting test automation using selenium
Architecting test automation using seleniumDavid Adams
 
TrainmeSofttech - Selenium Training
TrainmeSofttech - Selenium Training TrainmeSofttech - Selenium Training
TrainmeSofttech - Selenium Training Trainme Softtech
 
UI Automation Quirks
UI Automation QuirksUI Automation Quirks
UI Automation QuirksLucas Pang
 
The Future of Selenium Testing for Mobile Web and Native Apps
The Future of Selenium Testing for Mobile Web and Native AppsThe Future of Selenium Testing for Mobile Web and Native Apps
The Future of Selenium Testing for Mobile Web and Native AppsSauce Labs
 

Similar to Test automation & Seleniun by oren rubin (20)

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
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnet
 
前端網頁自動測試
前端網頁自動測試 前端網頁自動測試
前端網頁自動測試
 
Selenide vs. Selenium: The War Of Technologies
Selenide vs. Selenium: The War Of TechnologiesSelenide vs. Selenium: The War Of Technologies
Selenide vs. Selenium: The War Of Technologies
 
Challenges in test automation for web apps
Challenges in test automation for web appsChallenges in test automation for web apps
Challenges in test automation for web apps
 
探討Web ui自動化測試工具
探討Web ui自動化測試工具探討Web ui自動化測試工具
探討Web ui自動化測試工具
 
Automation Abstractions: Page Objects and Beyond
Automation Abstractions: Page Objects and BeyondAutomation Abstractions: Page Objects and Beyond
Automation Abstractions: Page Objects and Beyond
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Introduction to Selenium
Introduction to SeleniumIntroduction to Selenium
Introduction to Selenium
 
Javascript testing should be awesome
Javascript testing should be awesomeJavascript testing should be awesome
Javascript testing should be awesome
 
Selenium
SeleniumSelenium
Selenium
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.com
 
Architecting test automation using selenium
Architecting test automation using seleniumArchitecting test automation using selenium
Architecting test automation using selenium
 
TrainmeSofttech - Selenium Training
TrainmeSofttech - Selenium Training TrainmeSofttech - Selenium Training
TrainmeSofttech - Selenium Training
 
UI Automation Quirks
UI Automation QuirksUI Automation Quirks
UI Automation Quirks
 
Selenium
SeleniumSelenium
Selenium
 
Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver
 
Selenium with java
Selenium with javaSelenium with java
Selenium with java
 
The Future of Selenium Testing for Mobile Web and Native Apps
The Future of Selenium Testing for Mobile Web and Native AppsThe Future of Selenium Testing for Mobile Web and Native Apps
The Future of Selenium Testing for Mobile Web and Native Apps
 
Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
 

Recently uploaded

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 

Recently uploaded (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 

Test automation & Seleniun by oren rubin

  • 1. Test Automation & Selenium Oren Rubin CEO, Testim.io
  • 3. ● Why Unit Tests aren't enough? ● Writing Unit Tests !== Writing E2E Tests ● Meet Selenium ● Best practices & Design Patterns ● Selenium Grid ● UI Validations ● Record / Playback Today's Menu
  • 4. Selenium to UI-Testing is like.. Power Steering & Automatic Transmission is to Driving I'm not making you coffee!
  • 5. Unit Tests: Same language, Easy setup. Synchronous. // Setup Account account = new Account(); // Stimuli e.g. click, setting text, XHR account.login( "borg", "resistance is futile" ); // Validation assert( account.isLoggedIn(), true ); E2E vs. Unit - same same but different
  • 7. ● Synchronous? ● Same language? ● Easy setup? ○ Where are the browsers running? ○ Who's in charge of keeping them alive? E2E is hard!
  • 8. Expected: Actual: Cowabunga It gets worse.. I shit you not! Cowabunga Cowabungaz-index Cowabungasize CowabungaThe Flying Pony Cowabung a Over here! Blur, Focus, …. CSS HTML JS Event
  • 9. One browser.. you wish! * What about responsive design?!
  • 10. Which language do you prefer? Test Language?
  • 12. Why the name Selenium?
  • 13. Selenium 1 - JS based Selenium 2 - WebDriver & WebElements Selenium 3 - Mobile Past, Present, and Future
  • 14. Google Trends - Same for Jobs
  • 15. Example - la login
  • 16. // setup WebDriver driver = new Chrome(); driver.get("http://www.google.com"); // stimuli driver.findElement( By.id("user") ).sendKeys("mel brooks"); driver.findElement( By.id("password") ).sendKeys("12345"); driver.findElement( By.id("submit") ).submit(); // assertion assert(driver.getTitle(), "That's the kind of thing an idiot would have on his luggage!"); // tear down driver.quit(); Example
  • 17. Architecture ? Can anyone suggest a good architecture? ... ...
  • 18. One (W3C) Standard to rule them all! https://code.google.com/p/selenium/wiki/JsonWireProtocol http://www.w3.org/TR/webdriver/
  • 19. HTTP as a universal language ? The Wire Protocol SDK Driver
  • 20. Closer look new Chrome(); chromedriver.exe Browser HTTP Request localhost:4444/click driver = new Chrome(); ... submitBtn.click(); driver note: don't forget to frequently u chromedriver.exe
  • 21. Now for Firefox new Firefox(); webdriver.xpi Browser HTTP Request localhost:4444/click driver driver = new Firefox(); ... submitBtn.click();
  • 22. Let's improve loginChromeTest () { driver = new Chrome(); loginTest(driver); } loginFirefoxTest () { driver = new Firefox(); loginTest(driver); } loginTest (driver) { driver.findElement( By.id("user") ).sendKeys("mel brooks"); driver.findElement( By.id("password") ).sendKeys("12345"); driver.findElement( By.id("submit") ).submit(); }
  • 23. Page Objects A Design Pattern. Provides a programmatic API to drive and interrogate a UI Best Practices & Design Patterns http://www.slideshare.net/orenrubin/page-objects-presentation-selenium-conference-2014-38767492
  • 24. // setup WebDriver driver = new Chrome(); driver.get("http://www.google.com"); // stimuli driver.findElement( By.id("user") ).sendKeys("mel brooks"); driver.findElement( By.id("password") ).sendKeys("12345"); driver.findElement( By.id("submit") ).submit(); // assertion assert(driver.getTitle(), "That's the kind of thing an idiot would have on his luggage!"); // tear down driver.quit(); Example Simon says no! @Test void loginTest () {
  • 25. Test Automation Architecture Link to "Page Objects Done Right" Presentation
  • 26. Selenium Grid ● Concurrency ● Multiple Platforms
  • 27. Remember this? new Chrome(); chromedriver.exe Browser HTTP Request localhost:8989/click driver = new Chrome(); ... submitBtn.click(); driver
  • 28. What we want new Chrome(); chromedriver.exe Browser HTTP Request <some-ip>:8989/click driver = new Chrome(); ... submitBtn.click(); driver computer 1 computer 2
  • 29. Selenium Grid java -jar selenium.jar -port 4444 -role hub selenium hub Node 0 on 10.0
  • 30. Selenium Grid Node 1 on 10.1 Node 2 on 10.2 selenium node java -jar selenium.jar -role webdriver -browser firefox -hubHost 10.0 –port 8989 java -jar selenium.jar -port 4444 -role hub selenium node java -jar selenium.jar -role webdriver -browser chrome -hubHost 10.0 –port 8989 selenium hub Node 0 on 10.0 chromedriver.exe firefox-webdriver.dpi
  • 31. Selenium Grid new Chrome(); Browser HTTP Request 10.0:4444/chrome hub = new URL("10.0:4444/wd/hub") cap = new Capabilities ("chrome", "v3", "windows") driver = new RemoteWebDriver( hub, cap ); ... driver my computer / CI server Node 1 on 10.1 Node 2 on 10.2 selenium node java -jar selenium.jar -role webdriver -hubHost 10.1 –port 8989 java -jar selenium.jar -port 4444 -role hub selenium node java -jar selenium.jar -role webdriver -hubHost 10.1 –port 8989 selenium hub Node 0 on 10.0 HTTP Request 10.2:8989/chrome chromedriver.exe firefox-webdriver.dpi
  • 32. Selenium Grid new Chrome(); Browser HTTP Request 10.0:4444/click driver = ... submitBtn = driver.find(By.id("submit")); submitBtn.click(); driver my computer / CI server Node 1 on 10.1 Node 2 on 10.2 selenium node java -jar selenium.jar -role webdriver -hubHost 10.1 –port 8989 java -jar selenium.jar -port 4444 -role hub selenium node java -jar selenium.jar -role webdriver -hubHost 10.1 –port 8989 selenium hub Node 0 on 10.0 HTTP Request 10.2:8989/click chromedriver.exe firefox-webdriver.dpi
  • 33. Browsers in the cloud Selenium Grid as a Service SaaS Open source
  • 35. UI Verification - Applitools eye One image is worth a 1000 assertions