GitXplorerGitXplorer
w

plone.testlayers

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
7628faa15088664d880d5b00adabc89e06885677

fix source distribution by using a `MANIFEST.in` — this is needed since setuptools doesn't know about git yet...

wwitsch committed 16 years ago
Unverified
f5ce36244e86044c0423bd6139e32a6a27cb6a02

bump version

wwitsch committed 16 years ago
Unverified
16adf9d5231244b04a225bcf30b72dbf1d618e15

fix example & refer to http://github.com/ where the package actually lives

wwitsch committed 16 years ago
Unverified
99bc22b27790cd6d136c8b05ea9b2297e622fa22

prepare first alpha

wwitsch committed 16 years ago
Unverified
27b8f6e691a8e6ec0b661eb361ca88833d657c7e

import initial version

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)