[Zope3-dev] Test Layers

Martin Aspeli optilude at gmx.net
Tue Oct 17 07:28:22 EDT 2006




Chris Withers wrote:
> 
> Now, related to this, say I have content objects X and Y, which are 
> expensive to set up. I have LayerX which sets up a sample content object 
> X, and LayerY which does the same for content object Y. This is fine for 
> tests which need one or other content type, but how do I write tests 
> which need both?
> 

Layers are ... layered. If your test base class has layer X and a test case
subclass of that has layer Y, then it will set up X, run all the X tests,
then setup Y and run all the Y and X&Y tests, then tear down Y and then X.

I did this in Plone recently, but it completely escapes me where. Maybe I'll
have an epiphany after lunch, but look at how the ZCML layer in
PloneTestCase trunk works (it sets up all kinds of ZCML) and then try to
derive a class from PloneTestCase (or your equivalent) and set layer =
myLayer.

Martin



-- 
View this message in context: http://www.nabble.com/Test-Layers-tf2458447.html#a6853085
Sent from the Zope3 - dev mailing list archive at Nabble.com.



More information about the Zope3-dev mailing list