[TIP] Getting started writing DocTests for Web applications

Fran Boon flavour at partyvibe.com
Mon Jan 19 00:44:39 PST 2009


Olemis Lang wrote:
> On Fri, Jan 16, 2009 at 2:49 AM, Fran Boon <flavour at partyvibe.com> wrote:
>> I have started a project to rewrite Sahana in Python.
>> We have ambitious plans to do quality testing:
>> https://trac.sahanapy.org/wiki/DeveloperGuidelinesTesting
>> I'd like to start with doc tests as these make for inline docs for
>> developers & can build automatic API docs using epydoc.
>> I'm having trouble getting started as examples look at nice clear
>> mathematical operations whilst our functions mostly generate HTML.
>> Once there are a couple of examples to copy, this will make it easier to
>> incorporate throughout.
> Use doctest or dutest [1]_ loaders and specify an HTML-aware output
> checker (e.g. lxml.doctestcompare.LHTMLOutputChecker [3]_, [4]_ ...)
> Perhaps there are different options out there ... Pls feel free to
> send us (the list ;) feedback about your research ...

Thanks for the pointer to your promising-looking program :)
- I've still had trouble getting started though ;)


Inspired by this post:
http://agiletesting.blogspot.com/2006/04/in-process-web-app-testing-with-twill.html

I am now looking at:
http://code.google.com/p/wsgi-intercept/

& using this with CherryPy's WebTest:
http://www.cherrypy.org/browser/trunk/cherrypy/test/webtest.py

Comments on thsi apporoach welcomed :)

I'll report back when I've started to make real progress...

F



More information about the testing-in-python mailing list