Django's test client is very limited when it comes to testing complex interactions e.g. forms with hidden or persisted values etc. Twill excels in this area, and thankfully it is very easy to integrate it.

Use twill_setup in your TestCaseSubClass.setUp() method

in your method Use twill_teardown in TestCaseSubClass.tearDown() method

in method In a test, use something like make_twill_url() to generate URLs that will work for twill.

to generate URLs that will work for twill. Use twill.commands.go() etc. to control twill, or use twill.execute_string() or twill.execute_script() .

etc. to control twill, or use or . Add twill.set_output(StringIO()) to suppress twill output

to suppress twill output If you want to write half the test, then use twill interactively to write the rest as a twill script, use the example in unfinished_test()

Twill will raise exceptions if commands fail. This means you will get 'E' for error, rather than 'F' for fail in the test output. If necessary, it wouldn't be hard to wrap the twill commands to flag failure with TestCase.assert_

There are, of course, more advanced ways of using these functions (e.g. a mixin that does the setup/teardown for you), but the basic functions needed are here.

See also:

