Django Support in Trunk

22 views
Skip to first unread message

Mikeal Rogers

unread,
Sep 8, 2008, 2:11:18 AM9/8/08
to Windmill Dev
I just made a pretty large checkin that adds support for running Windmill tests from your Django test framework.

I won't be documenting it until we push it out in a release so I figured I should send out and email to show how it works.

Basically what I did was take some code that has yet to be checked in to Django for running tests against a live server (ticket #2879http://code.djangoproject.com/ticket/2879) and ported it to dynamically patch the pieces of the Django unittest framework it needed to and add a new TestCase class that could kick off windmill's test framework.

All you need to do is add a new WindmillUnitTestCase subclass anywhere that will get picked up by the Django unittest framework (http://www.djangoproject.com/documentation/testing/#writing-unit-tests ). You tell the class where your tests are and what browser to use and it does all the rest for you.

Here is an example from the new windmill unit test for making sure this feature stays working:

from windmill.authoring import djangotest

class TestProjectWindmillTest(djangotest.WindmillDjangoUnitTest):
   test_dir = '/Users/mikeal/Documents/svn/project/windmilltests'
   browser = 'firefox'

Now the next time that you run `$ python manage.py test` in your Django app it'll kick off the windmill tests.

Your windmill tests don't need to change at all, and you should still debug them using windmill and not the django unittest stuff because we have some pretty advanced debugging workflows that just aren't possible with unittest.

It's all in trunk, I'd appreciate any feedback ya'll can give me.

-Mikeal
Reply all
Reply to author
Forward
0 new messages