Alex Rivera | Logout

Django unit testing for form edit

Asked 2010-02-13T15:01:24.657
27

Someone has probably already developed a technique for relieving the tedium for the following idiomatic unit test:

  1. GET a url with form data already populated
  2. POST a revised form with one or more fields edited
  3. Check response (profit!)

Step 2 is the most tedious, cycling through the form fields. Are there any time-saving hacks for testing Django forms?

[Update: I'm not testing Django forms handling. I'm verifying that my application produces correct responses when a user makes changes to a form. This is an application which processes clinical information, hence a lot of possible responses to test.]

Edit
Report

1 Answer

0

I'd recommed you to take a look into acceptance testing level tools like robot test framework or letucce which are thought just for you want to do "I'm verifying that my application produces correct responses when a user makes changes to a form", that sounds more like acceptance (black-box) testing than unit-testing.

For instace, Robot let you to define your tests in tabular form, you define the workflow once and then you can define easily a bunch of tests that exercise the workflow with different data.

answered 2012-03-30T12:12:10.767

Your Answer