Web Testing with
Selenium IDE and RC
David Henry
DavidHenry@coldfusionpowered.com
DISCLAIMER
I am not yet a Selenium "expert". This is what works well for
my team and our process is still in a state of evolution. Your
mileage may vary.
Test Automation:Good
Here's what you get with test automation:
• Frequent regression testing
• Rapid feedback to developers
• Virtually unlimited iterations of test case execution
• Support for Agile and eXtreme development methodologies
• Disciplined documentation of test cases
• Customized defect reporting
• Finding defects missed by manual testing
Test Automation:Bad
Here's what you pay to get test automation:
• Tests can be difficult to write
• Changes to your interface can break your tests
• Tests can have errors too
• Automated tests are pretty dumb
Selenium IDE
• Records clicks and typing
• Easy to write simple tests
• Limited Flexibility
• Records in xpath, very brittle
Show me!
Demo selenium IDE
• Open Google
• Find AKC
• Go to breeds
• Find Collie
• Verify that "The Collie is a devoted
family dog" is present
Selenium Core + RC
When to use RC instead of IDE
• Dynamic application
• Code Reuse
• Cross browser (IDE is FF only!)
• Programmatic control over execution (config file, db
operations, tie in with external apps, etc.)
Use a testing framework
The Selenium RC API is well suited for running with a testing
framework like JUnit or MXUnit
Did you say MXUnit?
Yep. Hey ya'll... watch this!
Shopping List:
• MXUnit - RIAForge
• JavaLoader - RIAForge
• Selenium Client / Server - http://seleniumhq.org/
Selector Tools
Firefox is your buddy!
Firefinder plugin
Add your own JS selector strategy
Don't be afraid to add css classes to page elements to help
write your tests
Extend Selenium
You can extend the default selenium object to encapsulate your
user interface and simplify the writing of test cases.
Add utility functions to make future tests easier to write. Be
DRY if you can.
Lets see what that looks like in Java and JUnit.
Adding your own selectors
DefaultSelenium.addScript(scriptcode,scriptname);
DefaultSelenium.addLocationStrategy(prefix,functionbody);
We hacked in JQuery selectors to scratch those hard to reach
places. I'm looking for a cleaner way to do this before I share
my code.
Reversible Operations
Scalable?
Running tests one at a time too slow? Want to test against
multiple OS? Try one of these:
Selenium Grid
Bromine
Flash or Flex?
Try FlexMonkium
Discuss, Review, Questions
???
If you think of questions later or need some help:
DavidHenry@coldfusionpowered.com