End-to-end Web Testing with Selenium ● Stefan Priebsch, e-novative GmbH ● ZendCon 2008, Santa Clara, CA
How do you test web applications?
Testing in a Nutshell ● Compare calculation result with expected value ● Automate it ● Repeat it (often)
Types of Tests ● Unit Tests ● System Tests ● Acceptance Tests ● Integration Tests ● Performance Tests ● Load Tests ● Usability Tests ●... and don't forget security!
System Tests
The Request Cycle ● Browser requests URL ● PHP generates HTML page ● Browser creates DOM tree ● Browser renders page ● Javascript transforms DOM tree ● Browser re-renders page ● Action triggers new request
Selenium IDE ● Capture & Replay Tool ● IDE for tests ● Firefox plugin ●
Live Demo
Selenium RC ● Browser Remote Control ● Supports most current browsers ● Java Proxy ●
PHPUnit Integration ● ● pear channel-discover pear.phpunit.de ● pear install phpunit/phpunit ● PHPUnit_Extensions_SeleniumTestCase
Live Demo
Continuous Integration ● CruiseControl, Continuum, Xinc ● ● PHPUnderControl ●
Virtual Machines ● XEN, KVM, VirtualBox, VMware ● Test automation requires ● Snapshot Management ● Scripting (VM start and stop)
Putting It Together ● setUp() ● Start virtual machine ● Install application ● Run test ● tearDown() ● Shutdown virtual machine ● Rollback to latest snapshot
This Gives You ● A flexible low-cost test lab to test your web application ● against different browsers ● against different operating systems ● against different databases ● in different configurations ● different application versions
Thank you.
(en) (de)