GitXplorerGitXplorer
w

plone.testlayers

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
89b299f1eb6f8858a37325328696ae3896a4c8e9

bump version

wwitsch committed 16 years ago
Unverified
932d3a69b08605b3174b07eabf368c61a048a47a

prepare third alpha

wwitsch committed 16 years ago
Unverified
20a65b6d2f4562ee78dd90810849868f3ab77bfb

support naming the layer so that there can be multiple

wwitsch committed 16 years ago
Unverified
b19695bd905a58e8adb11cbf80e122ace0090567

rename test layer (in preparation to add another)

wwitsch committed 16 years ago
Unverified
01d19139b209e1e034fe1c39203af01958fce858

bump version

wwitsch committed 16 years ago
Unverified
17e25af7953d57807d42c928c1129e08c5c7666e

prepare second alpha as the first's egg was missing some data

wwitsch committed 16 years ago

README

The README file for this repository.

plone.testlayers

Introduction

plone.testlayers_ is supposed to make setting up test layers for Plone integration tests quick and painless. It's main function, makeTestLayer will conveniently generate a test layer, which will load your packages ZCML and install them, apply a GenericSetup profile and help you set up sample content for speedier testing.

.. _plone.testlayers: http://github.com/witsch/plone.testlayers/

Usage

To make use of plone.testlayers_ you'd typically create a base test case for your package, somewhat like::

from Products.PloneTestCase import PloneTestCase as ptc from plone.testlayers import makeTestLayer

def create(portal): """ create sample content for test runs """ portal.invokeFactory('File', 'foo', title='foo', file='foo bar')

def destroy(portal): """ clean up sample content for test runs """ portal.manage_delObjects(ids='foo')

ptc.setupPloneSite() FooLayer = makeTestLayer(packages=('collective.foo', 'collective.bar'), profile='collective.foo:default', create=create, destroy=destroy)

class FooTestCase(ptc.PloneTestCase): """ base class for integration tests """ layer = FooLayer

With that in place you can now set up your individual test cases like::

from unittest import defaultTestLoader from collective.foo.tests.base import FooTestCase

class FooTests(FooTestCase):

  def testFoo(self):
      # the 'foo' object set up in the layer should already exist
      self.failUnless(self.portal['foo'])

def test_suite(): return defaultTestLoader.loadTestsFromName(name)