Testing
Some links and information to help you add automated testing to your products.
This tutorial is very complete and awesome. Probably the best place to get started: http://plone.org/documentation/tutorial/testing
A few useful commands:
- Run all of the tests in a product:
./bin/instance test -s Products.yourproduct
- Get information about the test coverage of the code in a product. The detailed report will go in ~/coverage:
-
./bin/instance test -s Products.yourproduct --coverage=$HOME/coverage
Roadrunner allows you to run a set of tests over and over again without rebuilding the temporary Plone site every time. Thus saving you insane amounts of time:
http://pypi.python.org/pypi/roadrunner
When using a debugger in doctests like this:
>>> import pdb; pdb.set_trace()
You will be dropped into a pdb prompt. But you will be one stack lower then you want to be. So the first thing you'll want to do is jump up a level in the stack. Then you will be where you want to be in the doctest code. Just use the pdb up command.
(Pdb) up











