Selenium
"Have you tested your web app today?"
Jason Huggins
Senior Developer
ThoughtWorks, Inc.
Chicago, USA
email: jrhuggins at thoughtworks.com
web: openqa.org/selenium/
Poll #1: Who knows what Selenium does?
What is Selenium?
- A free and open source...
- ...multi-browser...
- .. multi-platform...
- .. JavaScript-based...
- ...web application testing framework...
- ...that will make your users smile.
Which leads to my next question...
... you must define Web 1.0.
Note to self:
Put down mouse and pick up note cards.
Pets.com - The sock puppet mascot.
- <integer><plural noun>.com
- 37signals.com
- 43things.com
- 43folders.com
- 7dots.com
- 101dalmatians.com
Web 3.0 - Brain Implant Edition
That, my friend, is "Web 2.0" in a nutshell.
Why use Selenium?
Let's see a quick demo...
Selenium Theory
Let's take a step back and explain a few things.
The definition (again)
"A free and open source multi-browser, multi-platform web application testing framework that will make your users smile."
Let's dig deeper...
"... testing framework ..."
There are many types of software testing techniques.
Jason’s Testing Pyramid for Web Apps
"... testing framework ..."
"Acceptance [or 'functional'] tests are created from user stories. During an iteration the user stories selected during the iteration planning meeting will be translated into acceptance tests.
...
A user story is not considered complete until it has passed its acceptance tests."
"... testing framework ..."
- Functional testing vs. Unit testing
- Macroscopic vs. Microscopic
- Big things vs. Small things
- Holistic Testing vs. Atomic Testing
- Testing Connections vs. Testing Components
- It's Slow vs. It's Fast
"... testing framework ..."
"Smoke" testing:
"When you start your web app, does it blow up in smoke?"
"... testing framework ..."
"Black box" testing:
- You test only what your users see and do.
- No "secret" information available only to the test harness.
"... testing framework ..."
"White box" testing:
- You test what your users see and do, but...
- You also verify expected results "behind the scenes" in the database or file system or server logs.
"... testing framework ..."
"Regression" testing
- Once you write a test, automate its execution.
- When you change your code, run all tests again.
- Rinse and repeat... for the life of the project.
"... web application ..."
"... web application ..."
Many types of web applications:
- Content management systems (Plone, Mambo, etc.)
- Groupware (OpenGroupWare)
- Blogs (WordPress)
- "Enterprise" apps (MyThoughtWorks Time & Expense)
- AJAX apps (Basecamp, Flikr, Gmail)
- Web 2.0 apps, whatever that means. ;-)
"... web application ..."
Selenium is uniquely qualified to test these types of applications because it is itself written in JavaScript.
"... web application ..."
Most other tools in this space only emulate the browser at the HTTP layer -- so testing JavaScript is not supported and can never be supported because of the chosen architectural "paradigm".
"... web application ..."
A Web 1.0 point of view:
- jWebUnit
- Canoo WebTest
- Mechanize
- Default functional testing code included in Zope (Python) and Rails (Ruby)
"... multi-browser, multi-platform ..."
Browser support:
- Firefox
- Internet Explorer
- Safari
- Konqueror
- Don't see your favorite browser? [I could use your help! (hint, hint) :-) ]
- Theoretically, at least, any modern browser that supports JavaScript
"... multi-browser, multi-platform ..."
Operating system support:
- GNU/Linux
- Windows
- Mac OS X
- Perhaps more? [Treo, Nokia 770?... hint, hint... I could use your help! :-) ]
"... multi-browser, multi-platform ..."
Other tools only support one browser, one platform:
- SAMIE - IE only
- Watir - IE only
"... free and open source ..."
What freedoms?
- Freedom to fix bugs, especially critical bugs in the testing framework.
- Freedom to add features that are not in our "product roadmap".
- Freedom to script your tests in common and standard languages and libraries (JavaScript, Python, Ruby, Perl, Java, .Net etc.)
- Freedom to spend more money on what you want to spend it on.
"... free and open source ..."
"Complementary Goods" Theory:
For a consulting company, the less money that goes to software licences... The more potential money that could be spent on billable hours. :-)... Also, when the tools are free, more developers can become testers. Not the case when a tool is $1000/seat.
"... that makes your users smile."
Selenium demos well, and it proves to the user/client/customer that your web app is working.
So, what is Selenium?
A testing tool for web apps that use JavaScript in any browser on any operating system with tests written in any programming language-- friendly to developers, testers, and end-users.
Cool stuff...