Current

This document is valid for the current version of Plone.

No longer bin/instance test - use zc.recipe.testrunner

Zope 2 start-up script no longer supports running tests. You need to use zc.recipe.testrunner for this purpose.

Add to your builout.cfg:

parts = 
   ...
   test

[test]
recipe = zc.recipe.testrunner
defaults = ['--auto-color', '--auto-progress']
eggs = 
    ${instance:eggs}

Rerun buildout.Then you can run tests:

bin/test -s your.packagename

See z3c.recipe.testrunner page for more information.

Changes in PloneTestCase setup

If you previously set up a PloneTestCase as explained in the developer manual

you might need to change the initialization of Zope2 products:

from Products.Five import zcml
from Testing import ZopeTestCase as ztc
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneTestCase.layer import onsetup

@onsetup
def setup_product():

	import my.types
	zcml.load_config('configure.zcml', my.types)
	
	# We need to tell the testing framework that these products
	# should be available. This can't happen until after we have loaded
	# the ZCML.
	ztc.installProduct('TextIndexNG3')
	ztc.installPackage('my.types')


setup_product()
ptc.setupPloneSite(products=['my.types'])

ztc.installProduct('TextIndexNG3') needs to be moved out of the deferred method setup_product so it's initialized properly:

@onsetup
def setup_product():

    import my.types
    zcml.load_config('configure.zcml', my.types)
    
    # We need to tell the testing framework that these products
    # should be available. This can't happen until after we have loaded
    # the ZCML.
    ztc.installPackage('my.types')

#initialize products outside of the deferred (@onsetup) method, otherwise it's too late
ztc.installProduct('TextIndexNG3')

setup_product()
ptc.setupPloneSite(products=['my.types'])
see the blogpost describing this issue in more details