selenium - what it is and what you can do with it
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
Seleniumwhat 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
Applications
● Cross-browser testing● Continuous integration● (Scraping & automation)
Ecosystem
● Two versions● Many language bindings● Two development environments● Many playback backends
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
Selenium 1 vs 2
● v 1 is a list of testing steps● v 2 is an API for remote-controlling browsers
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
Selenium 2 / Webdriver APIs
● Write code to control the browser● Python, Java, Ruby, Perl, PHP, C#, node,
Groovy, etc.
Locators are for finding stuff
● Locators refer to page elements● Multiple strategies: id, class, text, xpath…● Ideally robust to minor page changes
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.
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
Getting started with Selenium 2
● Get language bindings● Write your first test● Run your first test
demo
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
demohttp://sauceio.com/index.php/2013/03/building-a-ci-system-using-selenium-builder-github-travis-and-sauce-labs/
Substitutions
● Builder: IDE or hand-coded scripts● Travis: another CI system, e.g Jenkins● Sauce OnDemand: your own infrastructure
or another provider like TestingBot
That’s it!
● Questions?● Follow me on @zarkonnen_com