37
WEB APPLICATION TESTING WITH SELENIUM Sargis Sargsyan QA Automation Engineer

Web Application Testing with Selenium

Embed Size (px)

Citation preview

Page 1: Web Application Testing with Selenium

WEB APPLICATION TESTING WITH SELENIUM

Sargis Sargsyan QA Automation Engineer

Page 2: Web Application Testing with Selenium

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

Page 3: Web Application Testing with Selenium

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!

Page 4: Web Application Testing with Selenium

INTRODUCTION

•  Basic of automation •  Why and how we’ll do it

Page 5: Web Application Testing with Selenium

Type Of Automated Testing

Page 6: Web Application Testing with Selenium

UNIT TEST IS TESTING SMALL UNIT OF CODE IN ISOLATION

Unit Testing

Page 7: Web Application Testing with Selenium

INTEGRATION TESTING TEST UNITS TOGETHER, BUT STILL FOCUSES ON THE CODE

Integration Testing

Page 8: Web Application Testing with Selenium

BATS TEST THE SYSTEM FROM THE PERSPECTIVE OF THE USER

Blackbox Automated Testing (BAT)

Page 9: Web Application Testing with Selenium

THE TEST PYRAMID IS A CONCEPT DEVELOPED BY MIKE COHN

Pyramid of the Testing

Page 10: Web Application Testing with Selenium

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!

Page 11: Web Application Testing with Selenium

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

Page 12: Web Application Testing with Selenium

Terminology

•  Selenium Core

•  Selenium RC

•  Selenium-WebDriver

•  Selenium Server

•  Selenium IDE

•  Selenium-Grid

Page 13: Web Application Testing with Selenium

CAN’T WE JUST USE OUR UNIT & INTEGRATION TESTS AND RUN OTHERS MANUALLY?

Why Do It?

Page 14: Web Application Testing with Selenium

IT WORKED YESTERDAY!

Regression

Page 15: Web Application Testing with Selenium

THIS TEST EXPLAINS EXACTLY WHAT I WANT AND WHAT YOU AGREED TO

Absolute Requirements

Page 16: Web Application Testing with Selenium

BATS TEST MUCH MORE PRODUCTION CODE WITH FEWER LINES OF CODE

Leverage

Page 17: Web Application Testing with Selenium

OUR APPROACH

Page 18: Web Application Testing with Selenium

TESTS DON’T DIRECTLY WORK AGAINST THE WEB APP

Separate Automation Framework

Web App Framework Tests

Page 19: Web Application Testing with Selenium

I TOTALLY UNDERSTAND WHAT THESE TEST ARE DOING.

Simple Test

Page 20: Web Application Testing with Selenium

I AM AN AUTOMATED TEST, I’LL BE DRIVING TODAY. YOU CAN ALL ME ARMAN

Test Drive Creation of Framework

Page 21: Web Application Testing with Selenium

DESIGNING THE ARCHITECTURE

Page 22: Web Application Testing with Selenium

EACH LAYER ONLY INTERACTS WITH THE LAYER IMMEDIATELY BELOW IT

Architecture

Page 23: Web Application Testing with Selenium

THE FRAMEWORK ITSELF SHOULD BE DIVIDED BY LAYERS OF FUNCTIONALITY

Thinking About Layers

Page 24: Web Application Testing with Selenium

Thinking about Ease of Use

Page 25: Web Application Testing with Selenium

THE CHOICE MAKES A HUGE DIFFERENCE

Which is Easier?

OR

Page 26: Web Application Testing with Selenium

PREPARE TO BECOME AN AUTOMATION NINJA!

Let’s Start the Coding

Page 27: Web Application Testing with Selenium

COMMON FAILURE POINTS

Page 28: Web Application Testing with Selenium

NEVER RECORD A TEST CASE!

Recorded Brittle Test

Page 29: Web Application Testing with Selenium

NEVER RECORD A TEST CASE!

Not Building a Framework

Page 30: Web Application Testing with Selenium

WHAT THE HECK AM I LOOKING AT?

Writing Test Like a Code

Page 31: Web Application Testing with Selenium

NOT EVERYTHING CAN BE AUTOMATED!

Automating Hard Things

Page 32: Web Application Testing with Selenium

•  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

Page 33: Web Application Testing with Selenium

•  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

Page 34: Web Application Testing with Selenium

MAKE SURE AUTOMATED TEST ARE TAKEN SERIOUSLY

Our Continuous Integration

Page 35: Web Application Testing with Selenium

HOW YOU WILL FEEL WHEN YOUR AUTOMATED TESTS ALL PASS

The End!

Page 36: Web Application Testing with Selenium

THANK YOU! Time for Questions

Page 37: Web Application Testing with Selenium