[TIP] What strategies to you use to factor seleniums tests to avoid duplications of the same or similar test steps?

Bob Clancy bob.clancy at verizon.net
Wed Feb 13 17:13:33 PST 2008

    I'm coming up to speed on Selenium becase I think it may be useful in
upcoming jobs.  Two interesting areas of reading so far have been:


The second of these is an OReilly "ShortCut" book (about 60 pages) that gets
you started with the basics on testing with twill and Selenium.  The first
link above is a slide-show that offers some deeper insights about where 's
strengths and weaknesses are.  After following along with the OReilly
exercises, and rereading the slide-show, it doesn't look like it will be
easy to avoid "duplicated test logic" in Selenium. This makes me want to use
another framework where I can structure action words to do higher level
actions needed in testing.  I want something like the way that Mercury
QuickTest Pro allows you to call other actions from within an existing
action.  I've used that approach in QTP and it worked well for me.

    I'd like to hear of others have experience in factoring out "duplicate
functionality" from Selenium or whether you just use Selenium lightly (only
for client-javascript and cross-browser testing).  One idea that comes to
mind is to use Selenium from another language and call into Selenium tests
from FIT instead of using Selenium's test runner.  Another idea is to write
lots of selenium "Domain Specific Actions" that do basic higher-level
application-specific operations (such as logging in or out of an
application) that would otherwise be repeated very often as duplicate code.
This might be more work that it's worth in Selenium, so using another
framework more suited to domain specific keywords seems more natural to me.
Another such framework could be twill.  You could develop "DSL" keywords in
twill that call out to recorded tests where needed, and do the http-only
server tests where they are needed.

    Also I'm interested in knowing if anyone has strategies for grabbing the
http calls produced by the client that are sent to the server.   I've used
JMeter as a proxy recorder in the past, but it would be nice to have an
integrated tool that does action words at the high level, does javascript
testing in the slower browser based mode, but records and optimizes the http
calls and automatically associates them to tests so you can first record in
the browser, and then optimize some of this out to http requests to test the

    I hope I'm making sense in what I'm trying to say.  Basically I want the
best of all worlds where possible, and I'm interested in learning what
strategies you use to accomplish goals similar to the ones that I have
stated above.

Bob Clancy  (9 Lives Software Engineering,  Boston, MA, USA)

More information about the testing-in-python mailing list