32
Selenium for Pythonistas Add real browsers to your Utility Belt! sso@saucelabs - @santiycr - Sauce Labs

Selenium for pythonistas

Embed Size (px)

DESCRIPTION

Talk given for the San Francisco Python Meetup at Yelp on May 8th, 2013. Focused mainly in Selenium and Testing tips.

Citation preview

Page 1: Selenium for pythonistas

Selenium for PythonistasAdd real browsers to your Utility Belt!

sso@saucelabs - @santiycr - Sauce Labs

Page 2: Selenium for pythonistas

Who's this dude?

Santiago Suarez OrdoñezLead Backend Developer - Sauce LabsCommitter - Selenium Project6+ years on Selenium and Python

Page 3: Selenium for pythonistas

How about Sauce Labs?

Browsers in the cloudTest mobile and web apps in parallel+150 OS/Browser platformsVideos, screenshots, logs, badges, FLOSS

Page 4: Selenium for pythonistas

Agenda

Selenium is just a libraryTesting best practicesSelenium best practicesAdvanced featuresDebuggingQ&A

Page 5: Selenium for pythonistas

SeleniumHistory and Goals

Page 7: Selenium for pythonistas

What people use it for?Common use cases for real browsers

Page 8: Selenium for pythonistas

Let's focus on testingThat's what you're here for

Page 9: Selenium for pythonistas

DRYThat's what you're here for

Page 10: Selenium for pythonistas

MOCK ALL THE THINGS!!If you didn't write it, don't rely on it

Page 11: Selenium for pythonistas

Write small testsLess is more

Page 13: Selenium for pythonistas

Avoid inter-test dependencies

Independent tests are good!

Page 14: Selenium for pythonistas

Tests Start

Test Create Account(User A)

Test Login(User A)

Test Change Password(User A)

Test Close Account(User A)

Page 16: Selenium for pythonistas

Keep your build green100% green is the only green

Page 18: Selenium for pythonistas

Make writing tests easyIf it takes > 30 min, I'm not gonna do it

Page 19: Selenium for pythonistas

Now regarding SeleniumThere's lots of Selenium best practices

Page 21: Selenium for pythonistas

Generate application stateThe UI is the slowest path to any state in

your app

Page 22: Selenium for pythonistas

Use Guinea PigsTest complex widgets out of app workflows

Page 24: Selenium for pythonistas

ParallelizeBrowsers are slow and bulky.

Throw hardware at the problem.

Page 26: Selenium for pythonistas

Use Page Object ModelsThey are just code abstractions, you know?

Page 27: Selenium for pythonistas

Use Javascriptexecute_script("window.antigravity")

Page 28: Selenium for pythonistas

Use waits in your testsImplicit and Explicit waits will get you 90% there

Page 29: Selenium for pythonistas

Debugging failuresConsumes 99% of your time while working

with Selenium

Page 31: Selenium for pythonistas

Questions?Hot Sauce anyone?

Page 32: Selenium for pythonistas

sso@saucelabs - @santiycr - Sauce Labs

Thanks!