selenium testing on chrome - google devfest armenia 2015

39
Selenium Tes+ng on Chrome Sargis Sargsyan

Upload: sargis-sargsyan

Post on 15-Jan-2017

1.036 views

Category:

Software


3 download

TRANSCRIPT

Page 1: Selenium Testing on Chrome - Google DevFest Armenia 2015

Selenium Tes+ng on ChromeSargis Sargsyan

Page 2: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›2

Designing The Architecture

4

Introduction

1

Basics of automation

2

Why and how we’ll do it

3

How to design an automation

framework

5

Creating Basic Selenium Test

6

Building Out The Framework

7

Designing framework

for more tests

8

Best Practices and Tips

9

Common Failures

0

Main Topics

Page 3: Selenium Testing on Chrome - Google DevFest Armenia 2015

Introduction

`

Page 4: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›4

Type Of Automated Testing

Blackbox Automation

Testing

Unit Testing

Integration Testing

Page 5: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›5

Unit testing

Page 6: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›6

Integration Testing

Page 7: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›7

Blackbox Automated Testing (BAT)

INP

UT

OU

TP

UT

Page 8: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›8

Why Do Blackbox Testing?

Ĥ

Leverage

y

Regression

`

Absolute Requirements

Page 9: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›9

Pyramid of the Testing

Integra(on Tests

Unit Test

BAT Tests

Intern

al Qu

alityE

xtern

al Qu

ality Exe

cutio

n T

ime

Total C

ost o

f Ow

ne

rship

Page 10: Selenium Testing on Chrome - Google DevFest Armenia 2015

Selenium

p

Page 11: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›11

A Bit of History

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

Simon Stewart started working on another web testing tool called WebDriver

Selenium RC and WebDriver are merged into a one project called S e l e n i u m -W e b D r i v e r ( a k a Selenium 2.0)

The first working draft of W e b D r i v e r A P I W 3 C Specification is released

Selenium Grid is released

2012

7

2004

q

2013

1

2009

Z2006

a

Page 12: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›12

What is Selenium?It is an open-source project!

1.Windows

2.Mac

3.Linux

Selenium is a web application testing framework that allows you to write tests in many programming languages

Selenium deploys on

Page 13: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›13

Supported Main Browsers

WW WWW

Page 14: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›14

Terminology

Selenium Core

Selenium RC Selenium WebDriver

Selenium Server

Selenium IDE

Selenium-Grid

Page 15: Selenium Testing on Chrome - Google DevFest Armenia 2015

Architecture

`

Page 16: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›16

Architecture

FrameworkL

Chrome Browser (Web App)

Ħ

Selenium Tests X

Selenium Web Driver

Ä

Page 17: Selenium Testing on Chrome - Google DevFest Armenia 2015

Setup

V

Page 18: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›18

Download Selenium Library

Page 19: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›19

Download Chrome WebDriver

Page 20: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›20

Add Library to Project Structure

Page 21: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›21

Setup Chrome WebDriver

Page 22: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›22

Create Base Class

Page 23: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›23

Create Page for Google

Page 24: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›24

Create a Test to Check Search in Google

Page 25: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›25

Let’s Run the Test

Page 26: Selenium Testing on Chrome - Google DevFest Armenia 2015

WebDriver Features

Z

Page 27: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›27

Drag and Drop

Page 28: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›28

Maximize the Window

Page 29: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›29

JavaScript

Page 30: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›30

Scroll a WindowIt is possible to use Javascript election abilities

Page 31: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›31

Other Features

1 WebDriver can take a Screenshot

2 You can start the browser with an extension installed

3 Proxy configuration

Page 32: Selenium Testing on Chrome - Google DevFest Armenia 2015

Common Failures

l

Page 33: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›33

Recorded Brittle Test

Page 34: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›34

Not Building a Framework

Page 35: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›35

Writing Tests Like Code

Page 36: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›36

Trying to Automate Hard Things

Page 37: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›37

Error vs. Failure

Something other than what was being tested failed

The condition tested was not met

The framework threw an exception

An Assertion in the test failed

Test fail becauseTest error because

Page 38: Selenium Testing on Chrome - Google DevFest Armenia 2015

‹ ›38

Continuous Integration

1 Have a plan and stick to it

2 Run test as part of build

3 Run test locally

4 Report results

5 Break builds

Page 39: Selenium Testing on Chrome - Google DevFest Armenia 2015

✉ !

EMAIL TWITTER LINKEDIN

[email protected] mrsargsyan sargissargsyan

Contacts

ą

Thank You!