Using Python’s own unittest package, here’s a small script that can iterate over your test suite to output a small, quick, nice list of the tests in your application:
This would yield something like this:
Business
Accounts have at least one entry
Clerks cannot close accounts
Security
Users can create new accounts
Anonymous users cannot access private areas
...
Of course, you’ll get better results if you follow Google’s naming conventions for your tests… ;) This is not rspec (nor an alternative to it) but it might be useful to some of you.
Just as a reminder for Django users: you might need to
setenv DJANGO_SETTINGS_MODULE application.settings
or
export DJANGO_SETTINGS_MODULE=application.settings
in order to make the script work properly! At least I had to :)
2 Comments
#1. Batiste Bieler 04.18.2008
The use of a “Customized action” will maybe remove the need to set DJANGO_SETTINGS_MODULE in Django:
http://www.djangoproject.com/documentation/django-admin/#customized-actions
#2. Adrian 04.18.2008
Excellent! I didn’t know that one. Thanks!
Commenting