diff options
Diffstat (limited to 'docs/howto')
| -rw-r--r-- | docs/howto/index.txt | 1 | ||||
| -rw-r--r-- | docs/howto/windmill-tests.txt | 58 |
2 files changed, 59 insertions, 0 deletions
diff --git a/docs/howto/index.txt b/docs/howto/index.txt index 1a27a2ebac..214f36e47f 100644 --- a/docs/howto/index.txt +++ b/docs/howto/index.txt @@ -25,6 +25,7 @@ you quickly accomplish common tasks. outputting-csv outputting-pdf static-files + windmill-tests .. seealso:: diff --git a/docs/howto/windmill-tests.txt b/docs/howto/windmill-tests.txt new file mode 100644 index 0000000000..3321bb1869 --- /dev/null +++ b/docs/howto/windmill-tests.txt @@ -0,0 +1,58 @@ +.. _howto-windmill-tests: + +Writing a Functional Tests with Windmill +======================================== + +.. currentmodule:: django.test + +If you need to test overall behaviors of your site, ajax widgets or rendered +html, then functional tests are the solution. Django includes support for the +popular `Windmill`_ framework. Writing a windmill test +is simple, following these steps: + +.. _Windmill: http://getwindmill.com + +#. Your windmill tests must be their own module, named ``wmtests`` or ``windmilltests``. + +#. Django must be able to run any function in the module without arguments.:: + + from windmill.conf import global_settings + ADMIN_URL = "%s/test_admin/admin" % global_settings.TEST_URL + from windmill.authoring import WindmillTestClient + from django.test.utils import calling_func_name + + def test_loginAndSetup(): + '''Mostly just a proof of concept to test working order of tests.''' + client = WindmillTestClient(calling_func_name()) + + client.open(url='http://localhost:8000/admin') + client.waits.forPageLoad(timeout=u'20000') + ... + +#. Your windmill testing module must load any files other than the module loader in ``__init__.py``.:: + + from primary import * + ... + +Setup and Teardown are done differently for windmill tests, and consist of the following +functions. : + + * :meth:`setup_module` + * :meth:`teardown_module` + +A sample implementation, in ``__init__.py``.:: + + from primary import * + + def setup_module(module): + module.property = fetch_property() + + def teardown_module(module): + module.property = None + + + +These methods can be included in any file with windmill tests. See `functest`_ +for more information. + +.. _functest : http://functest.pythonesque.org/
\ No newline at end of file |
