KEMBAR78
Web Application Testing with Selenium | PDF
WEB APPLICATION TESTING WITH SELENIUM
Sargis Sargsyan
QA Automation Engineer
Who This Presentation Is For
•  Developers or QA (Students who will become
developer or QA)
•  Know the basics of an automation tool
•  In this presentation Selenium
•  Want to create a real automation framework
WELCOME TO THE AUTOMATION FACTORY OF NAIRIT
What this Presentation Covers
•  Introduction
•  Basic of automation
•  Why and how we’ll do it
•  Designing The Architecture
•  How to design an automation framework
•  Creating Basic Selenium Test
•  The best place to start
•  Building Out The Framework
•  Refactoring
•  Designing framework for more tests
•  Best Practices and Tips
•  Continuous Integration, Scaling out, Agile, etc.
WE WILL AUTOMATE YOU!
INTRODUCTION
•  Basic of automation
•  Why and how we’ll do it
Type Of Automated Testing
UNIT TEST IS TESTING SMALL UNIT OF CODE IN ISOLATION
Unit Testing
INTEGRATION TESTING TEST UNITS TOGETHER, BUT STILL FOCUSES ON THE CODE
Integration Testing
BATS TEST THE SYSTEM FROM THE PERSPECTIVE OF THE USER
Blackbox Automated Testing (BAT)
THE TEST PYRAMID IS A CONCEPT DEVELOPED BY MIKE COHN
Pyramid of the Testing
Selenium is a web application testing
framework that allows you to write tests
in many programming languages like:
•  Java
•  C#
•  Groovy
•  Perl
•  PHP
•  Python
•  Ruby
What is Selenium?
Selenium deploys on
•  Windows,
•  Linux,
•  MAC OS.
It is an open-source project!
2004 – Jason Huggins creates a JavaScript based tool for automatic
testing called Selenium (now it is known as Selenium Core). Later
Selenium Remote Control (aka Selenium RC) was developed to address
the “same host origin” browser policy and allow many language bindings to
control the browser at a distance
2006 – Simon Stewart started working on another web testing tool called
WebDriver
2009 – Selenium RC and WebDriver are merged into a one project called
Selenium-WebDriver (aka Selenium 2.0)
2013 – The first working draft of WebDriver API W3C Specification is
released
A Bit of History
Terminology
•  Selenium Core
•  Selenium RC
•  Selenium-WebDriver
•  Selenium Server
•  Selenium IDE
•  Selenium-Grid
CAN’T WE JUST USE OUR UNIT & INTEGRATION TESTS AND RUN OTHERS MANUALLY?
Why Do It?
IT WORKED YESTERDAY!
Regression
THIS TEST EXPLAINS EXACTLY WHAT I WANT AND WHAT YOU AGREED TO
Absolute Requirements
BATS TEST MUCH MORE PRODUCTION CODE WITH FEWER LINES OF CODE
Leverage
OUR APPROACH
TESTS DON’T DIRECTLY WORK AGAINST THE WEB APP
Separate Automation Framework
Web App Framework Tests
I TOTALLY UNDERSTAND WHAT THESE TEST ARE DOING.
Simple Test
I AM AN AUTOMATED TEST, I’LL BE DRIVING TODAY. YOU CAN ALL ME ARMAN
Test Drive Creation of Framework
DESIGNING THE ARCHITECTURE
EACH LAYER ONLY INTERACTS WITH THE LAYER IMMEDIATELY BELOW IT
Architecture
THE FRAMEWORK ITSELF SHOULD BE DIVIDED BY LAYERS OF FUNCTIONALITY
Thinking About Layers
Thinking about Ease of Use
THE CHOICE MAKES A HUGE DIFFERENCE
Which is Easier?
OR
PREPARE TO BECOME AN AUTOMATION NINJA!
Let’s Start the Coding
COMMON FAILURE POINTS
NEVER RECORD A TEST CASE!
Recorded Brittle Test
NEVER RECORD A TEST CASE!
Not Building a Framework
WHAT THE HECK AM I LOOKING AT?
Writing Test Like a Code
NOT EVERYTHING CAN BE AUTOMATED!
Automating Hard Things
•  Test fail because
•  The condition testes was not met
•  An Assertion in the test failed
•  Test error because
•  Something other than what was being testes failed
•  The framework threw an exception
IT IS IMPORTANT TO MAKE A DISTINCTION BETWEEN ERRORS & FAILURES
Error vs Failures
•  Have a plan and stick to it
•  Run test as part of build
•  Run test locally
•  Report results
•  Break builds
MAKE SURE AUTOMATED TEST ARE TAKEN SERIOUSLY
Continuous Integration
MAKE SURE AUTOMATED TEST ARE TAKEN SERIOUSLY
Our Continuous Integration
HOW YOU WILL FEEL WHEN YOUR AUTOMATED TESTS ALL PASS
The End!
THANK YOU!
Time for Questions
Web Application Testing with Selenium

Web Application Testing with Selenium

  • 1.
    WEB APPLICATION TESTINGWITH SELENIUM Sargis Sargsyan QA Automation Engineer
  • 2.
    Who This PresentationIs For •  Developers or QA (Students who will become developer or QA) •  Know the basics of an automation tool •  In this presentation Selenium •  Want to create a real automation framework WELCOME TO THE AUTOMATION FACTORY OF NAIRIT
  • 3.
    What this PresentationCovers •  Introduction •  Basic of automation •  Why and how we’ll do it •  Designing The Architecture •  How to design an automation framework •  Creating Basic Selenium Test •  The best place to start •  Building Out The Framework •  Refactoring •  Designing framework for more tests •  Best Practices and Tips •  Continuous Integration, Scaling out, Agile, etc. WE WILL AUTOMATE YOU!
  • 4.
    INTRODUCTION •  Basic ofautomation •  Why and how we’ll do it
  • 5.
  • 6.
    UNIT TEST ISTESTING SMALL UNIT OF CODE IN ISOLATION Unit Testing
  • 7.
    INTEGRATION TESTING TESTUNITS TOGETHER, BUT STILL FOCUSES ON THE CODE Integration Testing
  • 8.
    BATS TEST THESYSTEM FROM THE PERSPECTIVE OF THE USER Blackbox Automated Testing (BAT)
  • 9.
    THE TEST PYRAMIDIS A CONCEPT DEVELOPED BY MIKE COHN Pyramid of the Testing
  • 10.
    Selenium is aweb application testing framework that allows you to write tests in many programming languages like: •  Java •  C# •  Groovy •  Perl •  PHP •  Python •  Ruby What is Selenium? Selenium deploys on •  Windows, •  Linux, •  MAC OS. It is an open-source project!
  • 11.
    2004 – JasonHuggins creates a JavaScript based tool for automatic testing called Selenium (now it is known as Selenium Core). Later Selenium Remote Control (aka Selenium RC) was developed to address the “same host origin” browser policy and allow many language bindings to control the browser at a distance 2006 – Simon Stewart started working on another web testing tool called WebDriver 2009 – Selenium RC and WebDriver are merged into a one project called Selenium-WebDriver (aka Selenium 2.0) 2013 – The first working draft of WebDriver API W3C Specification is released A Bit of History
  • 12.
    Terminology •  Selenium Core • Selenium RC •  Selenium-WebDriver •  Selenium Server •  Selenium IDE •  Selenium-Grid
  • 13.
    CAN’T WE JUSTUSE OUR UNIT & INTEGRATION TESTS AND RUN OTHERS MANUALLY? Why Do It?
  • 14.
  • 15.
    THIS TEST EXPLAINSEXACTLY WHAT I WANT AND WHAT YOU AGREED TO Absolute Requirements
  • 16.
    BATS TEST MUCHMORE PRODUCTION CODE WITH FEWER LINES OF CODE Leverage
  • 17.
  • 18.
    TESTS DON’T DIRECTLYWORK AGAINST THE WEB APP Separate Automation Framework Web App Framework Tests
  • 19.
    I TOTALLY UNDERSTANDWHAT THESE TEST ARE DOING. Simple Test
  • 20.
    I AM ANAUTOMATED TEST, I’LL BE DRIVING TODAY. YOU CAN ALL ME ARMAN Test Drive Creation of Framework
  • 21.
  • 22.
    EACH LAYER ONLYINTERACTS WITH THE LAYER IMMEDIATELY BELOW IT Architecture
  • 23.
    THE FRAMEWORK ITSELFSHOULD BE DIVIDED BY LAYERS OF FUNCTIONALITY Thinking About Layers
  • 24.
  • 25.
    THE CHOICE MAKESA HUGE DIFFERENCE Which is Easier? OR
  • 26.
    PREPARE TO BECOMEAN AUTOMATION NINJA! Let’s Start the Coding
  • 27.
  • 28.
    NEVER RECORD ATEST CASE! Recorded Brittle Test
  • 29.
    NEVER RECORD ATEST CASE! Not Building a Framework
  • 30.
    WHAT THE HECKAM I LOOKING AT? Writing Test Like a Code
  • 31.
    NOT EVERYTHING CANBE AUTOMATED! Automating Hard Things
  • 32.
    •  Test failbecause •  The condition testes was not met •  An Assertion in the test failed •  Test error because •  Something other than what was being testes failed •  The framework threw an exception IT IS IMPORTANT TO MAKE A DISTINCTION BETWEEN ERRORS & FAILURES Error vs Failures
  • 33.
    •  Have aplan and stick to it •  Run test as part of build •  Run test locally •  Report results •  Break builds MAKE SURE AUTOMATED TEST ARE TAKEN SERIOUSLY Continuous Integration
  • 34.
    MAKE SURE AUTOMATEDTEST ARE TAKEN SERIOUSLY Our Continuous Integration
  • 35.
    HOW YOU WILLFEEL WHEN YOUR AUTOMATED TESTS ALL PASS The End!
  • 36.