[Django] #34184: Improve tutorial by mentioning User Interaction testing like django-webtest

1 view
Skip to first unread message

Django

unread,
Nov 25, 2022, 8:41:01 AM11/25/22
to django-...@googlegroups.com
#34184: Improve tutorial by mentioning User Interaction testing like django-webtest
-----------------------------------------+------------------------
Reporter: Kees Hink | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: 4.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/34184>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 25, 2022, 9:33:47 AM11/25/22
to django-...@googlegroups.com
#34184: Improve tutorial by mentioning User Interaction testing like django-webtest
-------------------------------+--------------------------------------

Reporter: Kees Hink | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: 4.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by Kees Hink:

Old description:

> 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.

New description:

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)

--

--
Ticket URL: <https://code.djangoproject.com/ticket/34184#comment:1>

Django

unread,
Nov 25, 2022, 10:17:50 AM11/25/22
to django-...@googlegroups.com
#34184: Improve tutorial by mentioning User Interaction testing like django-webtest
-------------------------------+--------------------------------------
Reporter: Kees Hink | Owner: nobody
Type: New feature | Status: closed
Component: Documentation | Version: 4.1
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => wontfix


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/34184#comment:2>

Reply all
Reply to author
Forward
0 new messages