Upload
sargis-sargsyan
View
686
Download
1
Embed Size (px)
Citation preview
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