[Fixed]-Does Django have BDD testing tools comparable to Rails' testing tools?


There is a new tools called Lettuce that promises to be a Pythonic version of Cucumber. It is starting with Django integration. That plus the existing testing tools in Django make it pretty good for unit testing.

There’s also a tool called Windmill that provides a solid browser-based testing tool for building GUI tests. Couple that with a tool like Lettuce for writing acceptance tests and the straight unittest and nosetests and I’d say you’re set.

The thing to remember, there’s a slightly different culture between Ruby and Python. Ruby has a preference for tests above all else. In Python it’s documentation. As such, there’s not a million and one testing frameworks in Python, just a few really solid ones with the occasional outlier (like Lettuce).

Hope this helps.


in case someone is still visiting here,
Aloe, is a lettuce upgrade and has integration for django 1.8.
I’m starting to use it now.


If you are referring to high level testing, and not unit testing, then you can still use Cucumber. Cucumber can be hooked up with Webrat and Mechanize, and you can use that setup to write stories to test your Django app. I have a setup like that. You can also hook up Cucumber with Watir, and do browser based testing.

There isn’t something like FactoryGirl to auto generate data for your model, but you can use Django fixtures to create initial data for your model, and only have the fixtures installed when you are in testing mode. Then you can start a test, and have some data to test with.

With those things, you can setup a fairly comprehensive high level test suite. Then you can use Django unit test to do low level testing.


I’m working with Robot Test Framework http://code.google.com/p/robotframework/. It is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD).

It’s flexible and powerful and also allows BDD style in a similar way to lettuce/cucumber.



I had a good experience with TestBrowser, which allows you to write functional tests at a high level. See http://pypi.python.org/pypi/h*m*phony for integration of TestBrowser with Django.

Leave a comment