Attention

This document was written for an old version of Plone, Plone 3, and was last updated 1502 days ago.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

Testing examples

by Martin Aspeli last modified Apr 09, 2009 10:58 AM
Here, we list a few packages and projects that demonstrate good test coverage

Testing is best learned by example. It can be very instructive to read through the tests written by other developers and learn what they test, what they don't test and how they write their tests.

  • example.tests, which we have already mentioned, contains an example of each of the different types of tests covered in this tutorial. The test setup code is well-commented, with the intention that this package should provide good boilerplate for developers setting up a new project.
  • Plone itself has more than 1,600 tests at the time of writing. Most of these are integration tests using unit-test syntax with PloneTestCase.
  • RichDocument has a basic test_setup.py integration test. This is a good example of the kind of testing you may want to do to ensure that your package installs cleanly.
  • borg.project contains a README.txt file with an integration doctest demonstrating how it is used. It has only a single test module, tests.py, which performs the same setup as base.py and test_integration_doctest.py from example.tests.
  • Many of the tests in the plone.app.controlpanel package use basic test-browser functional tests to verify that the Plone control panels work as expected.

Feel free edit or comment on this page if you have more examples to add!


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.