Forum OpenACS Q&A: Adding Selenium Tests to OpenACS

We need a quick way to create tests to make sure that fundamental UI based functionality of all packages labeled "mature" work. Period.

We have tclwebtest, but experience says people are not creating UI tests using it because it is too hard.

I have been looking for an alternative that allows recording of tests by browsing a site you want to test, but I could not find anything that was easy to use for test creation -- that was before Selenium (the testing framework) and Selenium Recorder (a Firefox extension).

Check out this wiki page:

Then check out these example tests I had Solution Grove create (for MGH):

Summary: I want to contribute these test files (they are html tables that are visible in the example), I want to get Selenium on the test servers so people can run smoke tests and we can pre-populate the stable versions for demos, I want people to contribute tests so we can get a higher quality packages out the door (this kind of brain-dead repetitive testing is what computers SHOULD be doing)

Questions: Can we get this on the test servers and start committing tests to the toolkit so that we can cover all the packages that will be included in .LRN 2.2 with at least one Selenium test per package? Objections/suggestions? Who can help?

Posted by Carl Robert Blesius on
Almost forgot: Kudos to Hamilton for creating all of these tests and setting the demo up for your viewing pleasure (he is also the one that has been watching Selenium and doing the evangelism in the background).
Posted by Hamilton Chua on
Thanks Carl !!!

I think the developers of selenium and the selenium recorder deserve most of the praise. It's an incredible testing tool. One that empowers regular users of our web applications to easiy do regression and unit testing.

Ok, before we do start the ball rolling with Selenium we have to make a few decisions. Just 2 for now.

1) Do we install selenium on the server ?

Before selenium-recorder was developed there was no other choice but to install selenium on the server. Now that we have selenium-recorder, it is now possible to create tests and execute (play) them from firefox without selenium installed on the server.

Personally I am for installing selenium on the server because ...
- we can take advantage of user extensions from selenium
- we can use our own custom tcl scripts to create test data

2) Where do we put the tests ?

Automated test scripts from the OpenACS automated test package are placed in tcl/test.

It'm not certain if we can do the same for selenium.

Normally I would put everything in www/selenium/tests.

File storage tests , for instance, would be in www/selenium/tests/file-storage, Forum tests would be in www/selenium/tests/forums and so on.

I'm going to see if it's possible to put the tests in say package/package_name/www/tests. If it's not possible to do so, we may have to consider putting all the tests in one place instead of putting them in their respective packages.

In the medium to long term we should consider writing a driver for selenium in the same manner that there is a Ruby and Java driver.

Posted by Dave Bauer on
I would not put the tests under package-key/www/

That would make them accessible to anyone visiting the site. If we put them under package-key/test/ we should be able to make them show up under /test/ for automated testing using an index.vuh page to redirect to the appropirate package.

For example /test/forums/ would go to packages/forums/tcl/test/

Posted by Cato Kolås on
Hi all,

this looks like a very nice tool that can even be used for stress-testing (I hope)...

But I'm have a bit of a problem finding out how to install Selenium on a server. It runs perfectly in Firefox/Selenium-ide on my PC. Any pointers?

Posted by Hamilton Chua on
There is no standard way of doing it right now.

What I do is decompress the file.

Once decompressed you should see "selenium-0.6.0" folder.
Inside this folder you will see a "selenium" folder

Get the selenium folder and put it in your instance's openacs/www/. Then to access it open a browser and go to

That will launch an index page with the default selenium tests.

Hope this gets you started.

Posted by Cato Kolås on
Yes, it worked like a dream... thanks!
Posted by Arbie Samong on
Has anybody tried to upload a file automatically from Selenium? It always returns a security error when the Selenium test is run from OpenACS as a package.

According to a Selenium forum, this is due to the javascript restriction being put in place. (

If one tries to run the same test in Selenium IDE it works fine. I already updated the core which was said to contain a fix for this, but I'm not sure if the fix will extend to the OpenACS package implementation.

Any similar experiences?

Posted by Hamilton Chua on
The selenium test package uses selenium core. If you have updated selenium core inside the selenium test package then it should work, that is if they really fixed the problem.

Upon checking the openqa site, it seems that they haven't

however, there is a link to a work around that unfortunately works on with firefox.