Last modified: 2014-09-15 08:48:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39230, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37230 - Provide standard way to create/run QUnit tests for Gadgets and user scripts
Provide standard way to create/run QUnit tests for Gadgets and user scripts
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Gadgets (Other open bugs)
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: javascript
Depends on: gadgets-2.0
  Show dependency treegraph
Reported: 2012-05-30 20:42 UTC by Helder
Modified: 2014-09-15 08:48 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Helder 2012-05-30 20:42:06 UTC
I was thinking about creating some QUnit tests for one of my user scripts and also for a gadget, but AFAIK there is no standard way to do this.

The [[Special:JavaScriptTest/qunit]] only says "This function has not been enabled on this wiki." but maybe it should provide a way to let users to run their QUnit tests, e.g. by defining the page name of a script, or some URL param.

For example, if a wiki has some gadgets the users (mainly sysops and gadget editors) could follow links to pages such as
[[Special:JavaScriptTest/qunit/<some name related to the gadget>]]
(or use a URL param, as in "Special:JavaScriptTest/qunit?gadget=foo") as soon as a gadget is changed, to ensure the latest changes didn't broke anything.
Comment 1 Helder 2012-05-30 20:46:45 UTC
One thing I'm not sure is where these tests should be defined: if a gadget has internal name "foo", but is defined on pages with different names, such as "MediaWiki:gadget-bar.js" and "MediaWiki:gadget-bar.css", where would we define the QUnit tests which would be executed when accessing
* [[Special:JavaScriptTest/qunit/foo]]
* Special:JavaScriptTest/qunit?gadget=foo

Should it be...
* ... in [[MediaWiki:Gadget-foo/QUnit.js]] ? (then it would not be very obvious for users that its code is related to [[MediaWiki:Gadget-bar.js]])
* ... in [[MediaWiki:Gadget-bar/QUnit.js]] (or [[MediaWiki:Gadget-bar.js/QUnit.js]]) ? (this would mean there could be more than one page where the Unit tests of a single gadget are defined - as many as the number of parts of this gadget)

What do you think?
Comment 2 Kunal Mehta (Legoktm) 2014-09-15 08:48:21 UTC
We can probably do this once the Gadgets 2.0 infrastructure is in place...making this depend upon that.

Note You need to log in before you can comment on or make changes to this bug.