Skip to main content

Easier test setup for Plone 3 projects.

Project description

ulif.plone.testsetup

is a package that provides some convenience stuff to enable rapid test setup for Plone packages. Currently doctests (normal unit doctests and functional doctests) and usual Python tests made of unittest.TestCase (and derived) definitions are supported.

Doctests and test modules are found throughout a whole package and registered with sensible, modifiable defaults.

Also support for reusable test setups is provided by so-called TestGetters and TestCollectors.

Setting up doctests (contrary to writing those tests) can become cumbersome with Plone. In the environment you often have to prepare complex things like test layers, setup functions, teardown functions and much more. Often this steps have to be done again and again.

ulif.plone.testsetup can shorten this work by setting sensible defaults for the most important aspects of test setups.

See README.txt in the src/ulif/plone/testsetup directory for API documentation. ulif.plone.testsetup is an extension of the Zope 3 package z3c.testsetup in which all the basic stuff is defined and documented. Please see the .txt files in this package for deeper insights about TestCollectors and the like.

Note, that this is alphaware! Do not use it in productive environments!

Prerequisites

You need:

- Python 2.4. Rumors are, that also Python 2.5 will do.

Other needed packages will be downloaded during installation. Therefore you need an internet connection during installation.

Installation

From the root of the package run:

$ python2.4 bootstrap/bootstrap.py

This will download and install everything to run buildout in the next step. Afterwards an executable script buildout should be available in the freshly created bin/ directory.

Next, fetch all needed packages, install them and create provided scripts:

$ bin/buildout

This should create an instance script in bin/.

Running:

$ bin/instance test -s ulif.plone.testsetup

you can test the installed package.

Usage

See README.txt and the other .txt files in the src/ulif/plone/testsetup directory for API documentation.

Detailed Documentation

ulif.plone.testsetup

A package for easier test setups with Plone 3.

ulif.plone.testsetup tries to ease the writing of testsetups. This can be a mess, especially when using Plone. There is always a complex framework to setup and all that might afraid people so that they do not write tests at all. In that sense, ulif.plone.testsetup is a try to take away excuses for not testing.

Note, that this package is meant for use with Plone 3. Other versions are not tested!

Please note also, that this document is not an introduction into writing tests, but into setup of tests. The difference is, that the many kind of tests supported by Zope and Python need to be found by a testrunner and some, functional tests for example, need a special framework to be setup before the tests can actually run. That’s what this package is for: minimizing the effort, to find and setup tests.

A Simple Test Setup

Setting up a test with this package in the minimal form comes down to this:

>>> from ulif.plone.testsetup import register_all_plone_tests
>>> test_suite = register_all_plone_tests(
...    'ulif.plone.testsetup.tests.cave')

This will find all tests registered in the cave package and deliver them to a testrunner when called. All we have to do, is to get the register_all_plone_tests function and to pass it a package.

We specified the package to be searched for tests by a so-called dotted name, but we can also pass the real package:

>>> from ulif.plone.testsetup.tests import cave
>>> test_suite = register_all_plone_tests(cave)

In both cases we will get a PloneTestCollector:

>>> test_suite
<ulif.plone.testsetup.plonetesting.PloneTestCollector object at 0x...>

When called, it will return a test suite:

>>> test_suite()
<unittest.TestSuite tests=[...]>

CHANGES

0.1.2 (2008-07-11)

Bug fixes

  • Pin down zope.testing version due to incompatibilities with plone.recipe.zop2install.

0.1.1 (2008-07-11)

Bug fixes

  • Fixed imports according to new z3c.testsetup release.

0.1 (2008-03-05)

Feature changes

  • Initial release, factored out from z3c.testsetup-dev

Download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

ulif.plone.testsetup-0.1.2.zip (19.5 kB view hashes)

Uploaded Source

ulif.plone.testsetup-0.1.2.tar.gz (9.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page