Greetings from Canada,
Selenium Remote Control 0.71 was just released, and it's an awesome
tool for automated functional web testing. Selenium RC is a java*
jar file that launches a combination web server and proxy that allows
you to use perl/python/ruby/java/c# scripts to launch and control a
browser. Selenium RC uses Selenium Core, a Javascript based browser
driver. Because it is all Javascript, it can drive both IE and
Firefox (as well as Safari, Camino and Konqueror).
Anyways, that's all fine and good, but I (we) need to get a sweet
perl driver test module up and running asap.
So I'm looking for some advice on a few questions. First, some
background.
While the java server was still in development, I created Test-WWW-
Selenium, a package that takes a slightly different approach to
driving Selenium. Whereas the java server is a standalone process
that proxies data, I wanted to make something simpler. Test-WWW-
Selenium is code that you install on your web server, and then launch
and point a browser at.
This approach makes sense in situations where you have full control
over the web site you're testing. This is probably the case for most
developer testing.
Test-WWW-Selenium is a couple cgi scripts that communicate through a
simple backend (file or message queue based). Your perl test script
sends commands via http to a cgi script which writes the commands to
disk, the browser fetches another cgi script which polls the disk for
the next command to run. Then the browser posts the result of that
command, which is written to disk, and finally read by the first cgi
script and returned to your perl test script. (Phew...)
Test::WWW::Selenium uses AUTOLOADer to create _ok, _like, _is,
_contains, ..., functions for each of the selenium commands to fetch
info from the browser. This is useful code that we'll want for the
perl driver.
Now that Selenium-rc is out, and it's good to go right now, and we're
starting to use it at $work, I want to get a solid perl driver sorted
out.
If you look at the Selenium-rc subversion (http://svn.openqa.org/
fisheye/viewrep/selenium-rc/trunk), you'll see that ruby, python and
java and dotnet all have simple drivers, dedicated to Selenium-RC.
Here's the options, as I see them:
Option 1. Leave Test-WWW-Selenium alone and write a separate module
that is simply a lightweight perl driver. Duplicate the AUTOLOADer
code from Test::WWW::Selenium. Some guys at Sophos already have a
simple module that does this.
Option A. Create a new "backend" in Test-WWW-Selenium that talks HTTP
to the Selenium-RC java server. This would allow Test-WWW-Selenium
to function as fairly lightweight client code.
Option Alpha. Transform the selenium XSLT file to autogenerate a
simple perl driver instead of using AUTOLOAD.
In order to be a first-class selenium client, the perl code should
probably live in the selenium subversion with the other clients.
These other clients don't contain any build code - they're not
packaged outside of selenium-rc. I'd still want to package the
driver up on the CPAN, so I'm not sure if I should just include the
Makefile.PL et al in this area, or do something more tricky.
At the risk of introducing even more questions to this already-too-
long post...
Does anyone have suggestions on making the Selenium test module
similar to something already existing (eg: WWW::Mechanize)?
Thanks if you've read this far, more thanks if you've got some ideas
about this stuff...
Luke
* - I know, I know, Java is gross, but we can either a) pretend it's
not java, or b) write our own.