No Fluff Just Stuff: Testing with Selenium with Neal Ford – level 200

On the 3rd day of NFJS, Neal gave a talk about
testing with Selenium.  Selenium is a
end-to-end testing solution for web applications.  This is testing on the customer acceptance
level and not the unit-testing level.


Selenium was developed by ThoughtWorks to test an
application they were working on.  It
grew out of an actual need.  The testing
framework was good enough to open-source it. 
They named it Selenium because it is the key mineral that protects the
body from mercury poisoning (if you recall Mercury testing tools).


With Selenium, tests run directly in the browser.  It supports most common browsers that are in
existence today.  The test engine itself
is written in JavaScript and runs directly in the browser.  It creates a compatibility layer across
browsers.  Calling an API in Selenium
will map to the right API in the current browser.


It deploys a browser bot that runs alongside your
application.  This bot can accept
commands.  The bot is embedded in an
IFrame.  Consequently, it will work with
any javascript-enabled browser.  To use
selenium, you must take the selenium folder and deploy it alongside the
application.  This will be in a
non-production environment, of course.


There are two modes for Selenium:  TestRunner mode and Driven mode.  In TestRunner mode, the browser is driven
inside the process.  In Driven mode, the
Selenium can be driven from another process remotely.


With TestRunner mode, Selenium is alongside the
application.  The user can launch it and
click the “Run Tests” button to run tests. 


Selenium test case is a simple html table.  The first row is a title and can be
ignored.  The next rows are the commands.  By default, it looks for


You can run Selenium tests directly in a browser and watch
it exercise your application at full speed or “walk” speed.  You can also step through.  If you need to run it from another process, you
can use Driven mode to run it from Ant, Nant, Maven, CruiseControl or anywhere.  Once you have a big suite of tests, you’ll
want to have it integrated with your normal build process.


There is a Selenium IDE that can be used to record
tests.  The IDE is an extension for
FireFox at  Selenium can test regular web applications as
well as AJAX web applications.