Sunday, August 8, 2010

Web application testing through Selenium-RC

WebTester is a framework to test web applications. Designed to support several testing systems, it actually provides an implementation which uses Selenium RC.

You can test any web application with it; but if you are developing Seaside applications you can take a component (any component), and unit test that component.

Download screencast (800x600): .mpeg 15.0 MB, .mov 36.9 MB

View mobile version.

Voice recorded by Christoph Budzinski.

Load WebTester (note that it loads Seaside 3.0-rc):
Gofer new
    squeaksource: 'MetacelloRepository';
    package: 'ConfigurationOfWebTester';

(ConfigurationOfAutotest project version:'1.1') load.

A WebTester session example:
|tester searchButton searchField|
tester := WtSeleniumWebTester new.
    appRoot: '';
    browserType: '*firefox';
    openUrl: '/'.

searchField := tester textFieldById: 'searchfield'.
self assert: searchField isPresent.

searchButton := tester buttonByXPath: '//input[@title=''Search'']'.
self assert: searchButton isPresent.

searchField text: 'screencasts'.
searchButton click.
tester waitForPageToLoad.
self assert: (tester isTextPresent:'pharocasts').

tester stop.


  1. Should ConfigurationOfAutotest in the 1st piece of code read ConfigurationOfWebTester instead?

    Thanks for this video.

  2. If you want to use Autotest, yes. WebTester is not tied to Autotest. You can use the SUnit GUI to run tests.
    You can also right click on the test / class and select 'run tests'.

  3. Sadly does not work in Pharo 1.4. Loading fails to bring in various classes such as the WtTextField, so trying to locate any text field on a page results in a "receiver of createById is nil' error.

    Seems to revolve around an inability to resolve dependencies, in particular some class called "GRPlatform" (and GRObject). I'm very unimpressed at this point with Montocello; I had thought the whole point of it was to resolve these issues.

    Any advice gladly received.


Note: Only a member of this blog may post a comment.