Basic unittesting for Plone
Fri, Aug 4, 2006,
100 Words
Create a new package called "tests" inside the product. Add modules that begin with test*, like testSetup. Next, run the tests with zope/bin/zopectl test -s Products.MyProduct (zope 2.9)
from Testing import ZopeTestCase
ZopeTestCase.installProduct('DRFSkin')
from Products.PloneTestCase.PloneTestCase import PloneTestCase
from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Products.PloneTestCase.PloneTestCase import setupPloneSite
setupPloneSite(products=('DRFSkin',))
class TestTool(PloneTestCase):
def afterSetUp(self):
pass
def testProductPath(self):
x = True
self.failUnless( x )
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestTool))
return suite
Reference: http://plone.org/documentation/tutorial/testing/tutorial-all-pages
Previous: Getting the real path of a zope product