CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeffrey Palermo [MVP]

Software management consultant and CTO, Headspring Systems

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 tests/TestSuite.html. 

 

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 http://www.openqa.org/selenium/.  Selenium can test regular web applications as well as AJAX web applications.



Comments

Vikas Kerni said:

Hi Jeffrey,
Is Selenium's use  different from Fit/Fitnesse  ?
As I understand that one can use Fit/Fitnesse for integration testing and I saw you have couple of posts on Fit/Fitnesse.
Thanks in advance

http://vikasnetdev.blogspot.com/2006/07/faq-fit.html
# July 11, 2006 9:27 PM

Jeffrey Palermo said:

Vikas,
Yes, Selenium is different from FitNesse.  FitNesse is a generic fixture layout that can be used to run any code.

Selenium is a javascript framework that runs against a browser to interact with a web application.
# July 11, 2006 11:18 PM

About Jeffrey Palermo

Jeffrey Palermo is a software management consultant and the CTO of Headspring Systems in Austin, TX. Jeffrey specializes in Agile coaching and helps companies double the productivity of software teams. Jeffrey is an MCSD.Net , Microsoft MVP, Certified Scrummaster, Austin .Net User Group leader, AgileAustin board member, INETA speaker, INETA Membership Mentor, Christian, husband, father, motorcyclist, Eagle Scout, U.S. Army Veteran, and Texas A&M University graduate. Check out Devlicio.us!

This Blog

Syndication