Random notes from mg

a blog by Marius Gedminas

Marius is a Python hacker. He works for Programmers of Vilnius, a small Python/Zope 3 startup. He has a personal home page at http://gedmin.as. His email is marius@gedmin.as. He does not like spam, but is not afraid of it.

Wed, 09 Mar 2005

Zope 3 request recorder

Zope 3 has this notion of functional doctests: functional tests (in the form of standalone doctest files) that pretend to perform HTTP requests to your Zope 3 server, and look at the response. Here's an example test from SchoolBell.

You can create functional doctests by using your browser and recording your session with TCPWatch, and then running a Python script that comes with Zope 3: dochttp. For some reason I found this method too cumbersome and usually just cloned existing doctests and changed the requests and responses by hand.

I now have a working prototype of a request recorder as a plug-in of Zope 3. You can set up a RecordingHTTP server on a separate port, and then go to /++etc++process/RecordedSessions.html to look at all requests you've made, filter them, and create a functional doctest.

Screenshot of /++etc++process/RecordedSessions.html

posted at 11:53 | tags: | permanent link to this entry | 0 comments

Name (required)


E-mail (will not be shown)


URL


Comment (some HTML allowed)