Bdd

Setting up django-behave

BDD
Install django-behave from pypi or github. Edit test_settings.py (or which settings file you use when running tests). Add this: INSTALLED_APPS += ('django-behave', ) TEST_RUNNER = 'django-behave.runner.DjangoBehave_Runner' Create a features dir, in the apps you want to test. If you then run test on that app, you should now see something like this: ` (ve)$ PYTHONPATH=. python proj/manage.py test author –settings=proj.test_settings E ERROR: runTest (django-behave.runner.DjangoBehaveTestCase) Traceback (most recent call last): File “…/ve/lib/python2.

django-behave

I like BDD. I like cucumber. I like python. I like django. I don’t like lettuce, a commonly-used python port of cucumber, when used with django. They’ve chosen the completely daft option to use your main database when testing. I’d forgotten this, so when I discovered I’d torched my production database just because I wanted to write a test, I decided to not touch lettuce again… And then I discovered behave, which works fine as a python BDD tool; except it doesn’t have an easy tie-up with django.