Performance: Testing forms
MEDIUM IMPACT
Testing forms affects development speed and server response time during test runs, impacting developer feedback loop and CI pipeline efficiency.
def test_form_validation(self): form = MyForm(data={'field1': 'value1', 'field2': 'value2'}) self.assertTrue(form.is_valid()) # No HTTP request, no DB writes
def test_form_submission(self): form = MyForm(data={'field1': 'value1', 'field2': 'value2'}) self.assertTrue(form.is_valid()) response = self.client.post('/submit/', data=form.cleaned_data) self.assertEqual(response.status_code, 200)
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Direct form validation testing | 0 (no DOM) | 0 | 0 | [OK] Good |
| Full HTTP form submission test | N/A (server-side) | N/A | N/A | [X] Bad |