[Zope-CMF] Re: [dev] writing tests for CMF 2.1
yuppie
y.2006_ at wcm-solutions.de
Thu Nov 9 06:00:57 EST 2006
Hi Chris!
Chris Withers wrote:
> yuppie wrote:
>> Layers
>> ------
>>
>> ZCML is set up using test layers. Their setUp() and tearDown() methods
>> are only run once for all tests in the layer.
>
> Maybe of interest, I've attached the layers file I use when testing Zope
> 2 apps. It "does the right thing" w.r.t. having a DemoStorage for each
> layer, letting you safely commit transactions containing layer setup and
> then using the using transaction.begin()/transaction.abort() dance in
> the tests themselves.
>
> Is this code useful? Should I look to check it in to the core anywhere?
1.) I doubt the transaction.begin()/transaction.abort() dance makes
still sense if you use DemoStorage.
2.) Whit did some test layer work on this branch:
http://svn.zope.org/Zope/branches/whitmo-2.10-layers/
Maybe you can join forces with him? It would be great if test layers
could be used instead of the ZopeTestCase test cases.
>> For functional tests that depend on a complete CMF site, you can use
>> the FunctionalLayers defined in the testing modules. They have to be
>> used with ZopeTestCase's FunctionalTestCase
>
> Hmmm, which version of Zope did this arrive in?
Don't know, I use the sandboxed test cases only with Zope 2.10.0. But
AFAICS the same pattern should work with Zope 2.9.5 as well.
> Finally, a question of my own, how do you use layers with doctests?
http://svn.zope.org/CMF/trunk/CMFCalendar/browser/tests.py?rev=71093&view=auto
Cheers,
Yuppie
More information about the Zope-CMF
mailing list