Posts

Showing posts from April, 2006

Selenium test creation and maintenance with make_selenium.py

Michał Kwiatkowski is the author of make_selenium.py, a useful Python module that can help you create and maintain Selenium tests. With make_selenium, you can go back and forth between Selenium tests written in HTML table format and the same tests written in Python.

When they start using Selenium, most people are drawn into using the Selenium IDE, which simplifies considerably the task of writing tests in HTML table format-- especially writing Selenium "action"-type commands such as clicking on links, typing text, selecting drop-down items, submitting forms, etc. However, maintaining the tests in HTML format can be cumbersome. Enter make_selenium, which can turn a Selenium test table into a Python script.

Here's an example of an HTML-based Selenium test that deals with Ajax functionality (see this post for more details on this kind of testing):

TestCommentaryopen/message/20050409174524.GA4854@highenergymagic.org
dblclick//blockquote
waitForConditionvar value = selenium.getTe…

In-process Web app testing with twill, wsgi_intercept and doctest

At the SoCal Piggies meeting last night, Titus showed us the world's simplest WSGI application:
def simple_app(environ, start_response):
status = '200 OK'
response_headers = [('Content-type','text/plain')]
start_response(status, response_headers)
return ['Hello world!\n'](see Titus's intro on WSGI for more details on what it takes for a Web server and a Web app to talk WSGI)

How do you test this application though? One possibility is to hook it up to a WSGI-compliant server such as Apache + mod_scgi, then connect to the server on a port number and use a Web app testing tool such as twill to make sure the application serves up the canonical 'Hello world!' text.

But there's a much easier way to do it, with twill's wsgi_intercept hook. Titus wrote a nice howto about it, so I won't go into the gory details, except to show you all the code you need to test it (code provided courtesy of twill's author):
twill.add_wsgi_inter…

PyCon 2006 talks on python.org

About half of the PyC0n06 presentations are now online on python.org. Among them is a PDF of my talk on Agile Documentation: using tests as documentation.

Should acceptance tests be included in the continuous build process?

This is the title of a post by Dave Nicolette, a post prompted by some back-and-forth comments Dave and I left to each other on my blog regarding the frequency of running acceptance tests. Dave argues that acceptance tests do not really belong in a continuous integration build, because they do not have the same scope as unit tests, and they do not give the developers the feedback they need, regardless of how fast they actually run.

Here are some of my thoughts on this subject. First of all -- thank you, Dave, for your comments and blog post, which prompted me to better clarify to myself some of these things. I will argue in what follows that the speed of tests is of the essence, and is a big factor in determining which tests are run when.

Following Brian Marick's terminology, let's first distinguish between customer-facing (or business-facing) tests and code-facing (or technology-facing tests). I think it's an important distinction.

Customer-facing tests are high-level tests…

30-second Selenium installation tutorial

For people new to Selenium, here's a 30-second (32.78 seconds to be precise) tutorial on how to install Selenium on a Linux box running Apache. I'll assume the DocumentRoot of the Apache installation is /var/www/html.

1. Download Selenium from openqa.org. The latest release of Selenium as of this writing is 0.6.
2. Unzip selenium-0.6.zip and cd into the selenium-0.6 directory.
3. Move or copy the selenium sub-directory somewhere under the DocumentRoot of your Apache server.

That's it -- you have a working Selenium installation!

Here's a screencast which contains the above steps. As I said, it took me 32.78 seconds to do all these things, and almost of all of that time was taken by the download of the zip file: QuickTime format and AVI format.

Now that you've installed Selenium, you might wonder what's your next step. Easy: open the following URL in a browser: http://www.yoursite.com/selenium/TestRunner.html ; you'll see the default test suite that is used to test…

Bunch O'Links on technical book writing and publishing

As synchronicity would have it, I've seen a lot of blog posts and articles lately on technical book writing and publishing. The one that has generated a lot of discussion was DHH's post on "Shaking up tech publishing". David talks about the success that 37signals have had in selling their Getting Real book online, in PDF format, and bypassing the traditional book publishing channels (here's a post from the 37signals blog with a 30-day update on their book sales). It's fascinating to read the comments on David's post, especially the ones from Tim O'Reilly (who doesn't need any introduction) and Gary Cornell (who does -- he's the publisher of APress). Tim talks at length about bestsellers, economies of scale, royalties, coping with too much success, etc. Gary Cornell responds with his point of view, then DHH throws in another wrench, and so on. Very entertaining.

I wish Tim and Gary would post their comments in their blogs, so that people could t…