Testing

Hanji implements the 2 frameworks (Django and Twisted) are used for (unit) testing.

Mainly Django is used for regular testing, whereas the Twisted tests are useful only for applets using Twisted functionalities.

Django

Applets should define a Python module (test.py or a test directory) containing Django django.test.TestCase (see this page).

From the installation directory, this is simply done using:

DJANGO_SETTINGS_FILE=hanji.settings hanji/manage.py test

Twisted (trial)

Twisted comes with a specific framework for unit testing: trial.

Instead of using directly the trial utility, Hanji provides a very slightly modified version (hanji_trial.py). Running a unit test is done by:

hanji_trial.py hanji.applets.my_applet.tests

In this example, all subclasses of twisted.trial.unittest.test.TestCase in the applet test module will be run against trial.

Table Of Contents

Previous topic

Developing rich web interfaces with Javascript

This Page