Opened 13 years ago

Closed 9 years ago

#16193 closed New feature (fixed)

Use qunit to test javascript in django source

Reported by: mbraak@… 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)

16193.diff (50.7 KB ) - added by mbraak@… 13 years ago.
qunit tests patch

Download all attachments as: .zip

Change History (12)

by mbraak@…, 13 years ago

Attachment: 16193.diff added

qunit tests patch

comment:1 by anonymous, 13 years ago

Code is in /tests/qunittests/

See README in this directory for instructions how to run the tests.

comment:3 by Julien Phalip, 13 years ago

Needs documentation: set
Triage Stage: UnreviewedAccepted
Type: Cleanup/optimizationNew 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.

comment:4 by Jannis Leidel, 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.

in reply to:  4 comment:5 by Julien Phalip, 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 mbraak, 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:8 by Nick Sandford, 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 Nick Sandford, 10 years ago

Owner: changed from nobody to Nick Sandford
Status: newassigned

comment:10 by Collin Anderson, 10 years ago

Cc: cmawebsite@… added

Do we still need this now that we have selenium tests?

comment:11 by Tim Graham, 9 years ago

Resolution: fixed
Status: assignedclosed

In 2d0dead224b6448072b72b37d2fbcc8dc3afa007:

DEP 0003 -- Added JavaScript unit tests.

Setup QUnit, added tests, and measured test coverage.

Thanks to Nick Sanford for the initial tests.

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