[ZWeb] Zope.org - take 3?

Paul Winkler pw_lists at slinkp.com
Wed Jan 26 10:14:22 EST 2005


On Wed, Jan 26, 2005 at 10:06:08AM +0000, Chris Withers wrote:
(snip)

I'm +1 on everything you said, except:

> >>7. (maybe) a functional test suite that actually tests all the 
> >>functional aspects we're aiming to support. Does anyone have lots of 
> >>experience producing functional test suites?
> >
> >not me, but ZopeTestCase should help.
> 
> Functional != UnitTest.

Paul != TotallyIgnorant.

>From ZopeTestCase/doc/FunctionalTesting.stx 


Functional Testing Readme

    The functional testing support of ZopeTestCase was inspired by
    Marius Gedminas' work for Zope 3.

    Deriving from the 'Functional' mix-in (and an xTestCase) adds a
    'publish' method to your test case class. Tests can call
    'self.publish(path, basic=None, env=None, extra=None,
request_method='GET')', 
    passing a path and, optionally, basic-auth info and form data. 
    The path may contain a query string.

    'publish' returns an enhanced Response object, that can be queried
    for status, response body, headers, etc.

    'publish' invokes the ZPublisher machinery just as if the request 
    had come in through ZServer. This allows for high-level testing
    of things like argument marshalling, form validation, and traversal.

    Note that the tests have *full access to the ZODB*. This means you
    can easily prepare a fixture for 'publish' and/or check the impact
    of a publication on the database. This represents a major advantage 
    over purely URL-based test environments!

    Please see the 'testFunctional.py' example test for more.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope-web mailing list