This guide is about development of wxPython's unit test suite. It assumes you have read GUI Unit Testing Project, which contains more basic information. To run the unit test suite, see the Unit Testing Quick Start Guide page.

Unit Test Development

This page is currently under construction. If you have any specific questions about the unit test suite, or would like to know how or why something works, please don't hesitate to contact frank.tobia@gmail.com

Currently the main thrust of development work is on verifying that all test failures across all platforms expose a meaningful bug in wx, rather than a bug in the unit test suite. Once this is complete, the suite will begin showing its usefulness, in keeping regressions at bay and verifying correct behavior of an implementation. At this point the unit test suite

The second phase involves expanding the unit test suite's coverage, by writing additional tests for classes and methods not currently under test. Below is the general procedure for adding tests.

Procedure for Adding Tests

  1. Check out the unit test suite into a local sandbox
  2. Identify a method or class whose behavior you'd like to have verified
  3. Write an appropriate test for the method or class (see below for details)
  4. Run the whole test suite with your changes
    1. Make sure your test doesn't break any other part of the test suite
    2. If your tests pass, this is probably a good thing; verify that your tests encapsulate the expected behavior of the unit you're testing
    3. If your tests fail, this may not be a bad thing; check if the test failure is a result of a bug in your test's implementation
      1. The test failure may represent some bug or inconsistency of behavior in wx; if this is the case, finding it is the highest purpose of writing tests :-)

  5. At this point you have a test suite working copy with local modifications. Create a patch file
  6. Submit a patch to the wxPython patch tracker

    1. <things you should include in a patch report>

Writing Tests

Adding tests to an already tested class

Example

Adding a new test class

Conventions

Code

Two spaces above 'if name == "main":' line.
Use double quotes except where inappropriate.
Use underscores rather than camelCase for variable naming.
Use lowerCamelCase for test method names.

Documentation

Each file has a docstring...

<write about docstrings>

Unit Testing Development Guide (last edited 2008-03-11 10:50:37 by localhost)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.