Showing posts from March, 2005

Quick update on Selenium in Twisted Server mode

Several people experienced problems when trying to follow my "Selenium and Twisted" tutorial. Here are some issues and some workarounds:

1) If you are on a Windows XP machine and, when trying to run, all you see in the SeleniumRunner page in the browser is:

CGI Script Error
Premature end of script headers

then you need to recompile nph-proxy.cgi into nph-proxy.exe by using the PAR utility. Marc Tremblay reported success by using PAR version 0.87 from here.

2) If you are on a Unix-like machine (Linux, Mac OS X, FreeBSD), then you need to modify to have it use nph-proxy.cgi instead of nph-proxy.exe.

You also need to run "dos2unix" on nph-proxy.cgi in order to convert from DOS line feeds to Unix line feeds.

3) The Twisted-based server doesn't seem to work properly on Windows 2000 Pro machines. Assuming is running in one command prompt window, then running the script in another window produc…


I gave my talk at PyCon05 yesterday. I surprised myself by managing to stay within the 20 minutes allocated for the talk. I even got to show "live" demos of FitNesse and Selenium. The only 2 questions I had at the end were both Selenium-related. It's clear that this tool fills a need that many people have.

Today I gave a "Lightning Talk" presentation with only 5 minutes at my disposal. I showed again a FitNesse demo testing the PyGoogle module, and 2 Selenium demos, one testing a Plone suite with the TestRunner, and the other testing a Google search in "driven" mode, using the Twisted-based implementation. I like to think that I was able to show how testing should really be done at 2 levels: the business logic/API level -- represented in my demo by testing the PyGoogle code via FitNessethe GUI level -- represented in my demo by testing the Google Web site via Selenium
The Lightning Talk session was really fun. People had to stay within the 5 minutes, s…

Using Selenium to test a Plone site (part 1)

I will give an example of using Selenium to test a Plone site. I will use a default, out-of-the-box installation of Plone, with no customizations. The functional test I'll present is written as an HTML table. In this post, I'm using Plone only as an example of a Web application. The test table I present uses generally-available "Selenese" commands that are not specific to Plone, so this example can be used as a mini-tutorial for writing HTML table-based tests in Selenium. If you want to see how Selenium can be used in conjunction with a stand-alone Twisted-based server, read this post.

Update: I just found out that Jason Huggins checked in a lot of Plone-specific Selenium code today, so obviously I haven't had the chance to experiment with that yet. I will follow up this post with another one, more targeted to specific features available in the Plone product version of Selenium (setUp, tearDown methods, and postResults for summarizing the test run).

Selenium is und…

Acceptance tests for Web apps: GUI logic

I've been looking at Selenium lately (see previous posts) as a tool for acceptance/functional testing of Web applications. In its standard "TestRunner" mode, Selenium allows you to write tests as HTML tables that contain actions related to the HTML elements of the Web pages you want to test. Actions can be commands such as "open" a page, "click" on a link, "type" in a text field, "select" a value from a drop-down box. Actions can also be checks that compare the values of HTML elements against expected values: "verifyText", "verifyValue", "verifyTitle", etc.

A typical Selenium test table looks like this:

Google Test Search
typeqSelenium ThoughtWorksverifyValueqSelenium ThoughtWorksclickbtnG
verifyTitleGoogle Search: Selenium ThoughtWorks

This type of test exercises the AUT (application under test) at the GUI level. It is an i…

Quick update on Selenium in TestRunner mode

Ian Bicking made a good point today on the selenium-devel mailing list: the introductory Selenium documentation makes things look much more complicated than they really are. And my previous post on Selenium falls in the same trap. It's true that I focused my tutorial on the Twisted server-driven mode of Selenium, but I should have made it clear that it's really easy to get started with Selenium in TestRunner mode if you have a Web application that you need to test.

Basically, all you need to do is to either download Selenium or check it out via svn from svn://, then copy the contents of the javascript directory (all its files and sub-directories) to a directory that can be served via your Web server.

I created a directory called selenium under the DocumentRoot directory of one of my Apache virtual servers, then I pointed my browser to and I was good to go -- that is, I could see all the sam…

Web app testing with Python part 2: Selenium and Twisted

In a previous post I mentioned Selenium as a Web app testing tool that is like no other in terms of functionality and implementation. I've been experimenting with Selenium for the past few days and I'm very impressed (a reaction which seems to be common to everybody who witnessed the tool in action.)

The main Selenium developer is Jason Huggins, who initially created Selenium as a tool for acceptance/functional testing of Web sites based on Plone. Jason is the author of two Python implementations for Selenium:
the "Plone Product" versionwritten as a Plone product,
it is used specifically for testing Plone-based sites
it needs to be installed on the Plone site under testthe "Twisted Server" versionwritten as a stand-alone Twisted-based server
can be used for testing any Web site This post is a tutorial in using the "Twisted Server" version of Selenium.

Update3/31/04: For specifics on running the Twisted Server version of Selenium on Unix-like systems, a…