Opened 13 years ago
Closed 9 years ago
#16193 closed New feature (fixed)
Use qunit to test javascript in django source
Reported by: | Owned by: | Nick Sandford | |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | testing javascript qunit |
Cc: | cmawebsite@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Use qunit to test javascript in django source, especially in contrib.admin.
I have a patch which tests some Date functions in core.js in the admin.
Attachments (1)
Change History (12)
by , 13 years ago
Attachment: | 16193.diff added |
---|
comment:1 by , 13 years ago
Code is in /tests/qunittests/
See README in this directory for instructions how to run the tests.
comment:2 by , 13 years ago
comment:3 by , 13 years ago
Needs documentation: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Cleanup/optimization → New feature |
Note that some similar work has been done in https://github.com/sebleier/django/tree/qunit
It'd be interesting to compare the two approaches, and also coordinate to avoid duplicating work.
See also #16122.
follow-up: 5 comment:4 by , 13 years ago
Patch needs improvement: | set |
---|
Well, the approach we took on Github (Sebleier's fork) is much more generic and prepared for app centric test running.
comment:5 by , 13 years ago
Replying to jezdez:
Well, the approach we took on Github (Sebleier's fork) is much more generic and prepared for app centric test running.
I actually played a bit with that branch a couple of weeks ago and it's looking great. I was wondering if you guys had thought of a way to test the admin interface (e.g. dynamically adding or removing inlines)? This would require generating a DOM from the up-to-date admin templates and with some test data. Perhaps we need to introduce a management command to generate fresh HTML files from the latest admin codebase, so that these can be tested with the admin javascript via qunit. I haven't thought of it much beyond that, but I'll try to get to it next week.
comment:6 by , 13 years ago
I see that the sebleier/qunit branch is much further developed than I initially thought. I will add my tests to this branch.
comment:7 by , 13 years ago
Some relevant discussion on django-dev: http://groups.google.com/group/django-developers/browse_thread/thread/e0656d72e5e863d7
comment:8 by , 10 years ago
Figure we just want *something* to unit test the django admin javascript as a first pass to fixing the more general problem. PR here: https://github.com/django/django/pull/3003. Needs more tests, and still 31 jshint errors.
comment:9 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:11 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
In 2d0dead224b6448072b72b37d2fbcc8dc3afa007:
DEP 0003 -- Added JavaScript unit tests.
Setup QUnit, added tests, and measured test coverage.
Thanks to Nick Sanford for the initial tests.
qunit tests patch