SeasideTesting is a package written by David Shaffer for testing Seaside components. David has written a good tutorial on writing tests using SeasideTesting.

I ported SeasideTesting to GLASS last summer. The current version on GemSource is SeasideTesting.g-R1.5-dkh.10 which is based on SeasideTesting-R1.5-mb.5. With a current version of the GLASS package (GLASS.230-dkh.190) a handful of the example tests are failing – there are later versions of the SeasideTesting package on SqueakSource. I will be working on updating to a later version of the package at a later date.

You have two choices when running tests:

  1. web-based test runner
  2. standard SUnit TestRunner

Web-based test runner

newtestrunner2In order to run the web-based test runner, you’ll need to launch a special Hyper server:

SeasideTestingSite launchSeaside: 9765

When you launch Hyper, your vm will block while it is serving Seaside pages. The special version of Hyper is needed, because of the way the web-based TestRunner launches a Hyper session to run the test while processing the original Seaside request.

Once you’ve launched Hyper, you can use your browser to navigate to http://<hostname>:9765/seaside/testRunner, where you can run individual test cases by clicking on the appropriate link.

For errors or failed tests you can click on the ‘Debug’ link to bring up a debugger.

When you are done testing through the web-based interface, you’ll need to interrupt the Hyper process (Alt-.) to get control back to the client.

SUnit TestRunner

seasidetestingtestrunner1You can also run the tests using the standard TestRunner window, just like any other TestCase. I’ve tested this using the OmniBrowser-based TestRunner available with the GemTools Client Preview and it works like a champ (I haven’t tried this technique with the older Morphic-based TestRunner window, so I can’t be sure that it will work correctly).

When you use TestRunner, you don’t have to start a special version of Hyper and you are able to debug the failures and errors like any other test case (without having to invoke the ‘remote debugger’, so I think that this would be the preferred technique.

A note on Albatross

Albatross is another framework for testing Seaside components, but I have yet to port it to GLASS. Since Albatross uses FFI, we may just wait until 3.0 (which has an FFI interrface) before porting Albatross.


[1] Photo by SideLong via Flickr (Creative Commons).