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

Fred Drake fdrake at gmail.com
Wed Feb 13 18:09:45 PST 2008

On Feb 13, 2008 8:13 PM, Bob Clancy <bob.clancy at verizon.net> wrote:
> 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.

For Zope 3 applications, there's a zc.selenium package on svn.zope.org
that provides an interesting approach.  In addition to being able to
write tests as nasty HTML tables, it allows writing selenium tests as
dynamic Zope 3 "views" that are similar to unittest-based tests.  Each
test class represents a fixture, and each test method is a
sub-fixture, using some views that push and pop database wrappers.

This makes it very easy for classes to have helper methods for
commonly used sequences of operations, parameters can be used to
parameterize the operations. The results are still Selenium test: they
run slowly, they're unreliable, and subject to all the bugs in
Selenium.  A separate tool is used to host and manage the running of
the tests, but they can be substantially automated.

For all that, we avoid writing Selenium tests like the plague.
They're slow, and are mostly interesting when there's browser-side
JavaScript.  As much as possible, we stick to doctest-based functional
tests that cover the application code, but not the shared web-server

Others here have used something called Sahi, but I don't have any
direct experience with that.  It has a different model than Selenium,
but mostly fills the same niche.  It has foibles of its own, so you
have to decide on the trade-off you want to make.


Fred L. Drake, Jr.    <fdrake at gmail.com>
"Chaos is the score upon which reality is written." --Henry Miller

More information about the testing-in-python mailing list