[Zope-CMF] Re: CachingPolicyManager improvements
geoff at phds.org
Sat Sep 3 16:24:40 EDT 2005
On Fri, 02 Sep 2005 18:42:56 -0400, Tres Seaver wrote:
> I'm not quite wure what ZTC buys us for unit testing; is it primarily
> used to get the environment right for a functional test? Is it needed
> when running the tests via 'bin/zopectl test' in an instance home?
I'm sure I won't do Stefan's work full justice (feel free to chime in,
Stefan!). The most important thing in my mind that ZopeTestCase does is
to make it simpler to set up your test fixture. ZopeTestCase creates a
new folder to work in, adds a user folder, and creates a user. It
provides methods to log in and out, to set permissions assigned to a role,
and to set roles assigned to users.
We ship a subclass of ZopeTestCase with Plone called PloneTestCase. An
instance of PloneTestCase creates a Plone site for you, installs a base
set of associated products, creates two members of the site, one with
Manager role and one with Member role, and creates folders owned by each.
It provides convenience methods for importing and installing
additional products, for logging in as given member, and so on.
With these tools in hand, most of the effort in writing tests goes into
actually testing one's code rather than into setting up a test fixture,
and that means the effort required to write tests is much less than if one
started with, say, one of the test case classes from
CMFCore.test.base.testcase. Shipping CMF with, say, a
CMFDefaultTestCase modeled after PloneTestCase would be a good way
to simplify the writing of tests of high level CMF functions, and it would
help developers writing CMF add-ons to write tests. It would also mean
more shared infrastructure and methods across Zope, the CMF, and Plone,
which would make it easier for Plone developers to contribute to the CMF.
More information about the Zope-CMF