Hacking Selenium @ JSConf

41
Hacking Selenium Jason Huggins @jhuggins [email protected] seleniumhq.org | p13y.com JSConf - 25 April 2009 [ ]

description

An overview and history of the Selenium web application testing tool, by Selenium's creator Jason Huggins. Presented on April 25, 2009 at JSConf in Arlington, Virginia.http://jsconf2009.com/speakers.html#huggins

Transcript of Hacking Selenium @ JSConf

Page 1: Hacking Selenium @ JSConf

Hacking Selenium

Jason Huggins@jhuggins

[email protected] | p13y.com

JSConf - 25 April 2009

[ ]

Page 2: Hacking Selenium @ JSConf

1 - Why Selenium?

Page 3: Hacking Selenium @ JSConf

Browser Wars II

3

6, 7 & 8

9.61.0

2, 3

Add-onsBrowser configsLanguages/locales

3, 4 beta

Page 4: Hacking Selenium @ JSConf

Test Automation

Source: - F.O.X.: http://www.flickr.com/photos/kv/499219/

Page 5: Hacking Selenium @ JSConf

Dynamic HTML - Ajax

Page 6: Hacking Selenium @ JSConf

End-to-end Workflows

Page 7: Hacking Selenium @ JSConf

Large tests

Page 8: Hacking Selenium @ JSConf

Any browser - Any platform

Page 9: Hacking Selenium @ JSConf

Selenium Cumulative Downloads

9

Page 10: Hacking Selenium @ JSConf

10

Firms with: 100+ downloads January – October 2008

Page 11: Hacking Selenium @ JSConf

2 - Why not Selenium ?

Page 12: Hacking Selenium @ JSConf

Speed

Source: http://desertpastor.typepad.com/paradoxology/Slow%205.jpg

Page 13: Hacking Selenium @ JSConf

Flash, Java Applets, Silverlight, PDF

Source: http://goldberg.berkeley.edu/art/big-images/doi-box-hi-res.jpg

Page 14: Hacking Selenium @ JSConf

Anything outside the JavaScript sandbox

Source: http://lug.mtu.edu/wiki/images/2/27/SANDBOX.jpg

Page 15: Hacking Selenium @ JSConf

Small tests

Page 16: Hacking Selenium @ JSConf

3 - A brief history of Selenium

Page 17: Hacking Selenium @ JSConf

ThoughtWorks Time & Expense

Source: - Neal Ford: http://nealford.com/downloads/conferences/2006_nfjs_canonical/Neal_Ford-Testing_with_Selenium-slides.pdf

Page 18: Hacking Selenium @ JSConf

First Attempt - JWebUnit

• Simulates the browser• Can’t handle browser-specific bugs• Can’t handle JavaScript in the DOM

Page 19: Hacking Selenium @ JSConf

Second Attempt - DriftWood

• Mozilla extension (never published)• Pro:

– Drove a real browser, so it could handle JavaScript UI features

• Con:– Not for IE or Safari :-( – XML Syntax for tests. Yuck!

Page 20: Hacking Selenium @ JSConf

Third Attempt - JsUnit

• Pro:– Can test JavaScript in the browser!– Works in Mozilla/Firefox, IE, and Safari!

• Con:– Emphasis on single-page unit test (no

page-to-page workflows)– Couldn’t see what it was doing

Page 21: Hacking Selenium @ JSConf

It’s Green, but what did it really work?

Page 22: Hacking Selenium @ JSConf

Fourth Attempt - FIT (part 1)

• Pro:– More readable tests– Emphasis on functional testing

Page 23: Hacking Selenium @ JSConf

Example FIT test

Page 24: Hacking Selenium @ JSConf

Fourth Attempt - FIT (part 2)

Con:• Wasn’t available for the “JavaScript

platform” yet• Limited list of “actions” in the API

Page 25: Hacking Selenium @ JSConf

Action Fixture picture

Page 26: Hacking Selenium @ JSConf

Forking FIT

• Selenium initially was an attempt to implement “FIT for web browsers”

• Ended up forking:– Wanted to see what the browser was doing– Wanted a richer API

Page 27: Hacking Selenium @ JSConf

4 - Side Note: What’s with the name?

Page 28: Hacking Selenium @ JSConf

“antidote for mecury poisoning”

Page 29: Hacking Selenium @ JSConf

“results - selenium”

Page 30: Hacking Selenium @ JSConf

Selenium and mercury detox

Page 31: Hacking Selenium @ JSConf

5 - Selenium Core

Page 32: Hacking Selenium @ JSConf

Selenium Core (TestRunner)

Page 33: Hacking Selenium @ JSConf

6 - Selenium IDE

Page 34: Hacking Selenium @ JSConf

Selenium IDE for Firefox

Page 35: Hacking Selenium @ JSConf

7 - SeleniumRemote Control

Page 36: Hacking Selenium @ JSConf

Selenium Remote Control

Source: - http://www.dkimages.com/discover/previews/824/5100491.JPG

Page 37: Hacking Selenium @ JSConf

Selenium Remote Control

Page 38: Hacking Selenium @ JSConf

8 - Selenium Grid

Page 39: Hacking Selenium @ JSConf

Selenium Grid

Source: - http://factoryjoe.com/blog/wp-content/uploads/2006/10/pods.jpg

17

Which is faster? (1 server, sequential tasks)

Time

Servers

1

2

3

4

Page 40: Hacking Selenium @ JSConf

40

18

Which is faster? (4 servers, parallel tasks)

Time

Servers

1

2

3

4

Page 41: Hacking Selenium @ JSConf

p13y.com

Source: - http://www.flickr.com/photos/onetreehillstudios/2958752337/