Testing Web Applications
Birmingham -- 31st August 2006
Paul Johnson
www.pjcj.net
Testing Web Applications
Two boring subjects
Testing
Web applications
Stir briskly
Combine ingredients
Exciting!
To make something really exciting!
Web 2.0
Web 2.0 compliant
Mashup
Two approaches
Test::WWW::Mechanize
Test::WWW::Selenium
Mechanize
Use perl as the browser
Based on LWP
Selenium
Use a browser as the browser
Based on Selenium
Selenium projects
Selenium is three projects in one
Selenium Core
Selenium IDE
Selenium Remote Control
Selenium Core
HTML and JavaScript
Commands to simulate user actions
Retreive page details
Reads commands from tables or URIs
JavaScript executes the commands
Selenium IDE
Firefox extension
Record and replay
Selenium Remote Control
Control core from a real language
Python
Ruby
Java
.net
Perl
(phew)
Selenium Server
Reads commands from a port
Runs the commands
Sends back results
Anything can speak to the server
Speaks HTTP
You can even type in commands interactively
Written in Java
Browsers
Launches a browser
Firefox
IE
Safari
Opera
and others
Demo
Bet it doesn't work properly ...
Installation
cpan -i Test::WWW::Mechanize
cpan -i Test::WWW::Selenium
cpan -i Alien::SeleniumRC
java -jar .../lib/site_perl/5.8.8/Alien/SeleniumRC/selenium-server.jar
Java 1.5 required for upcoming releases
Why?
Why choose Selenium?
Tests run in the browser
Cross browser testing
All your AJAXy goodness works
Why not?
Why not choose Selenium?
Mechanize is good enough
Selenium is generally slower than Mechanize
Need to run performance or load tests
Selenium needs a real browser
Wow
I said it would be exciting!