After you have created a TurboGears project with quickstart, you can start coding your web application right away, or, which is what we recommend, you can adopt a test driven development (TDD) style with TurboGears. What we describe here is completely optional, but it helps in creating structured, maintainable, and reliable software. You should also put the project code in a version control system, so that you can easily revert to an earlier stage should something go wrong.
In test driven development you develop in small iteration cycles, which are carried out repeatedly, until all tests are passing. One iteration covers the following steps:
If necessary:
- Refactor the code.
- Refactor the test (and elaborate).
Rinse and repeat...
After you create the quickstart project, you can start the test suite with the following command:
$ python setup.py test
This runs the nosetests tool, which will search your applications package directory and execute all test cases it finds which start with :doc:`/test`. When you create a new project, there will already be several test modules in the tests directory below your package directory, all named :doc:`/test`*.py. You can add more tests to these modules or add new test modules. See the nose documentation for information on how to write and name your test classes and functions.
This document showed you only the minimum you need to know to start with TDD. For more information on how to write tests for your TurboGears applications see the full Testing documentation.