Opened 2 years ago

Closed 2 years ago

#34184 closed New feature (wontfix)

Improve tutorial by mentioning User Interaction testing like django-webtest

Reported by: Kees Hink Owned by: nobody
Component: Documentation Version: 4.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Kees Hink)

Maybe the tutorial chapter about testing (https://docs.djangoproject.com/en/4.1/intro/tutorial05/) could be improved a bit by adding a reference to User Interaction testing, as provided for example by https://github.com/django-webtest/django-webtest.

One example where Django's TestCase is not super well suited is a form submit. Yes, it's possible to craft a POST request, but it's not guaranteed that a form will actually submit the same data.

Webtest allows user-like interaction by clicking items in a page, filling out a form and submitting it, and following redirects.

In my opinion it's very valuable for comprehensive testing, and i think our tutorial would improve if we mention it.

One could argue that Selenium (which is referenced on the page under "Further testing") could be used to achieve this, but that is more work to set up, and slower. (I do think Selenium / Playwright) has its place in other scenarios.) If it's about testing a form submit, no JavaScript, then webtest is more suitable, and very similar to Django's TestCase.

If this is a good idea, i'm happy to make a proposal PR. (Edit: I've made a suggestion at https://github.com/django/django/pull/16330)

Change History (2)

comment:1 by Kees Hink, 2 years ago

Description: modified (diff)

comment:2 by Carlton Gibson, 2 years ago

Resolution: wontfix
Status: newclosed

The Django docs have tended to shy away from particulars like this. TBH this is the first time I've heard of web test. That well be me but is it really an active and stable enough project to link to? Selenium seems on a whole different scale, but even that, folks seem to be leaning to Playwright these days... it's a mine-field, and it's not likely we'd be able (or want) to keep a tutorial up to date as things go out of date.

I'm going to say wontfix, but you're welcome to raise it on the DevelopersMailingList, which is a better forum for these kind of suggestions.

Note: See TracTickets for help on using tickets.
Back to Top