selenium - what it is and what you can do with it

19

Click here to load reader

Upload: zarkonnen

Post on 11-May-2015

185 views

Category:

Technology


2 download

DESCRIPTION

An introduction to Selenium, a technology for testing web sites. I give an overview of its ecosystem and also show you how to create a simple CI system based on Selenium Builder, GitHub, Travis and Sauce Labs.

TRANSCRIPT

Page 1: Selenium - what it is and what you can do with it

Seleniumwhat it is and what you can do with it

Page 2: Selenium - what it is and what you can do with it

Selenium

● Web testing framework● A faster way to see if your site works● Real browsers for fidelity

Test Server Browser

Page 3: Selenium - what it is and what you can do with it

Applications

● Cross-browser testing● Continuous integration● (Scraping & automation)

Page 4: Selenium - what it is and what you can do with it

Ecosystem

● Two versions● Many language bindings● Two development environments● Many playback backends

Page 5: Selenium - what it is and what you can do with it

IE Firefox Chrome Opera HTML Android Ghost etc.

Selenium Server

Webdriver APIs Se Interpreter

Selenium 1 Code Selenium 2 Code Builder JSON

Selenium IDE Selenium Builder

Selenium 1 Test

Selenium 1 APIs

Page 6: Selenium - what it is and what you can do with it

Selenium 1 vs 2

● v 1 is a list of testing steps● v 2 is an API for remote-controlling browsers

Page 7: Selenium - what it is and what you can do with it

Selenium 1 Tests

● Sequence of test steps● “Go to this page, click on this link, does this

text appear?”● Stored as “Selenese” table or code

Page 8: Selenium - what it is and what you can do with it
Page 9: Selenium - what it is and what you can do with it

Selenium 2 / Webdriver APIs

● Write code to control the browser● Python, Java, Ruby, Perl, PHP, C#, node,

Groovy, etc.

Page 10: Selenium - what it is and what you can do with it
Page 11: Selenium - what it is and what you can do with it

Locators are for finding stuff

● Locators refer to page elements● Multiple strategies: id, class, text, xpath…● Ideally robust to minor page changes

Page 12: Selenium - what it is and what you can do with it

Playback fidelity is hard!

● Javascript is everywhere: you can’t test a page just by looking at the HTML

● Want to run tests quickly but waits needed● Reliable locators can be hard● CSS rollovers, element visibility, etc.

Page 13: Selenium - what it is and what you can do with it

No silver bullet blah blah blah

● Selenium uses real browsers for fidelity● Implicit waits sometimes work● Write clean, testable pages● 80/20 automated/manual is still nice

Page 14: Selenium - what it is and what you can do with it

Getting started with Selenium 2

● Get language bindings● Write your first test● Run your first test

Page 15: Selenium - what it is and what you can do with it

demo

Page 16: Selenium - what it is and what you can do with it

Builder+GitHub+Travis+Sauce = CI

● Record tests with Selenium Builder● Store them on GitHub in the project repo● Use Travis to drive test runs on commit● Use Sauce Labs’ Selenium servers

Page 17: Selenium - what it is and what you can do with it

demohttp://sauceio.com/index.php/2013/03/building-a-ci-system-using-selenium-builder-github-travis-and-sauce-labs/

Page 18: Selenium - what it is and what you can do with it

Substitutions

● Builder: IDE or hand-coded scripts● Travis: another CI system, e.g Jenkins● Sauce OnDemand: your own infrastructure

or another provider like TestingBot

Page 19: Selenium - what it is and what you can do with it

That’s it!

● Questions?● Follow me on @zarkonnen_com