28
Stabilizing Selenium Build Dima Kovalenko [email protected] @dimacus

Stabilizing SE Build - Selenium conf 2013

Embed Size (px)

DESCRIPTION

Talk at 2013 Selenium Conference on the topic of stabilizing a build and making it green over all

Citation preview

Page 1: Stabilizing SE Build - Selenium conf 2013

Stabilizing Selenium Build

Dima [email protected]

@dimacus

Page 2: Stabilizing SE Build - Selenium conf 2013

We Are Hiring

[email protected]• @dimacus

Page 3: Stabilizing SE Build - Selenium conf 2013

Love My Job

• Love testing• Love hacking• Love talking about above

Page 4: Stabilizing SE Build - Selenium conf 2013
Page 5: Stabilizing SE Build - Selenium conf 2013

Partner In Crime

Darko MarinovAssociate ProfessorUniversity of Illinois

Page 6: Stabilizing SE Build - Selenium conf 2013

Stability is a Journey not destination

Page 7: Stabilizing SE Build - Selenium conf 2013
Page 8: Stabilizing SE Build - Selenium conf 2013

Culture

Page 9: Stabilizing SE Build - Selenium conf 2013

Culture Changes

• Convince Management that flakey tests waste a lot of money

• Discourage developers from relying on tests• Prevent red build from merging into

master/trunk• Red master is NOT OK!

Page 10: Stabilizing SE Build - Selenium conf 2013

Fix Ajax Waiting

• jQuery– evaluate_script("jQuery.active") == 0– evaluate_script('$(":animated").length') == 0

Page 11: Stabilizing SE Build - Selenium conf 2013

Flakey Tests

Page 12: Stabilizing SE Build - Selenium conf 2013

Self contained tests

• Separate Databases• Self reliant tests– Setup/Teardown

Page 13: Stabilizing SE Build - Selenium conf 2013

Faster Feedback Loop

• Fight to get build to 10 mins• Notify of failures before build is finished– Rspec/Cucumber Early Notification Formatters– Blog post to follow– engineering.groupon.com

Page 14: Stabilizing SE Build - Selenium conf 2013

Flakey Detector

• Check Jenkins or Git diff• If a test was modified, kick of flake detector

build– Run changed test 5k times in 10 mins– In random order– They should always be green!

• engineering.groupon.com

Page 15: Stabilizing SE Build - Selenium conf 2013

Fix Environment Problems!!

• Tests get blamed if environment fails• Standardize test boxes– Chef, Puppet, w/e

Page 16: Stabilizing SE Build - Selenium conf 2013

Flakey Environment

Page 17: Stabilizing SE Build - Selenium conf 2013

Windows Tips

• Don’t use IE• Move mouse out of browser in IE• Maximize test window• Don’t use RPD/RDC– Use VNC

Page 18: Stabilizing SE Build - Selenium conf 2013

Linux Tips

• Run Firefox in separate Desktop

Page 19: Stabilizing SE Build - Selenium conf 2013

Speed up tests

• Parallel more• Does it have to be Selenium?– Can this be a unit test?– Can it be headless?– Can you run Jasmine instead?

Page 20: Stabilizing SE Build - Selenium conf 2013

Black Hole Proxy

• Capture any external requests, return 200• Speeds tests up• Reliability goes up• em-proxy– https://gist.github.com/dimacus/5757573

Page 21: Stabilizing SE Build - Selenium conf 2013

Gem Cacher

• Cache any external dependencies locally• Don’t rely on rubygems.org to always be up!– github.com/dimacus/gem-cacher

• Local Maven repo

Page 22: Stabilizing SE Build - Selenium conf 2013

Credit on Grid idea

• David Burns• @AutomatedTester

Page 23: Stabilizing SE Build - Selenium conf 2013

Selenium Grid Extras

• github.com/groupon/Selenium-Grid-Extras

Page 24: Stabilizing SE Build - Selenium conf 2013

Basic Idea

• Help maintain the Environment to produce stable tests

• Turn Selenium Grid Nodes into dumb browsers

Page 25: Stabilizing SE Build - Selenium conf 2013

Control OS from tests

• Clean up old sessions• Kill browsers• Take full OS Screenshots• Move mouse• Reboot windows

Page 26: Stabilizing SE Build - Selenium conf 2013

Future plan

• Record videos• Share files with grid nodes• Spin up/down VMs on the fly• Image comparison• Auto update Selenium WebDriver• Black-hole proxy integration• Improve Grid API• Restart SE Node• Idle machine utilization

Page 27: Stabilizing SE Build - Selenium conf 2013

Need your help

• https://github.com/groupon/Selenium-Grid-Extras

Page 28: Stabilizing SE Build - Selenium conf 2013

Questions?

42!