Last modified: 2011-05-17 00:18:40 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 T28908, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 26908 - Make mediaWiki JS test suite better
Make mediaWiki JS test suite better
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.18.x
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Krinkle
:
: 26800 (view as bug list)
Depends on: 28915
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-24 21:11 UTC by Krinkle
Modified: 2011-05-17 00:18 UTC (History)
7 users (show)

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


Attachments

Description Krinkle 2011-01-24 21:11:06 UTC
We could move to a test system similar to the php parser tests.
Main advantage being no need to escape everything in addTest( '' );
<pre>
# hash lines ignored
!! test
Title here
!! input
javascript = 'being';
evaluated.with = the.EvalFunction();
return evaluated.with;
!! output
hello world
!! type (typeof output)
string
!! end
</pre>

Or we could use an existing framework (jQuery QUnit[1]) or even an off-site environment (eg. TestSwarm)


[1] jQuery QUnit: http://docs.jquery.com/Qunit
Example: http://view.jquery.com/tags/1.3.2/test/
[2] TestSwarm: https://github.com/jeresig/testswarm/wiki
Comment 1 Mark A. Hershberger 2011-01-27 03:05:30 UTC
It seems like this could fit somewhere in with the current Selenium Test Suite. No?
Comment 2 Michael Dale 2011-02-02 20:44:28 UTC
*** Bug 26800 has been marked as a duplicate of this bug. ***
Comment 3 Krinkle 2011-03-09 00:52:33 UTC
Just for the record, if we use this, it's not QUnit OR TestSwarm, but both,

QUnit provides the testing, TestSwarm to distribute to different browsers.
Using Selenium could work as well, although I dont know if TestSwarm supports that.
Comment 4 Krinkle 2011-05-08 15:57:03 UTC
Linkfix:
https://github.com/jquery/testswarm/wiki
Comment 5 Michael Dale 2011-05-08 16:47:38 UTC
TestSwarm looks like a light-weight selenium, ie selenium without the weight of the protocol and a http based controller instead of the selenium 'grid' system. 

TestSwarm looks easier to setup "new browsers" ( like mobile devices ) and would integrate better with arbitrary jQuery unit tests system ( like jasmin that the upload wizard is using and QUnit or whatever other folks use ). And it appears TestSwarm has support for selenium tests.  

What is the status of continues integration testing with selenium? The goal is clear, per commit automated testing and reporting. Maybe the last mile of dashboard like status with per-commit hooks, that has not materialized for selenium grid, would be more practical to realize with TestSwarm ?
Comment 6 Krinkle 2011-05-08 17:26:56 UTC
I agree it appears to be a good choise for us. However I've never used TestSwarm from a management point of view (I only run it as a client from time to time for the jQuery team, they use it themselfs here: http://swarm.jquery.org/ ).

I'm planning to experiment with it on my local test server. If that goes well I might show it to some people next week in Berlin [1] and perhaps we can set up something within WMF shortly after that (either on a WMF server of perhaps on the Toolserver first).

[1] http://www.mediawiki.org/wiki/Berlin_Hackathon_2011
Comment 7 Antoine "hashar" Musso (WMF) 2011-05-09 18:02:26 UTC
Krinkle > since I am interested by setting up a testswarm, I will come to you with a couple beers :-)
Comment 8 Krinkle 2011-05-10 18:08:11 UTC
Setting to assigned, I'm actively working on this.

Here's a few points (likely in this order, but not all per se)

== Init QUnit ==

Point 1: Get QUnit in core and prepare some core modules to be more easily testable (ie. return values)

Point 2: Create a basic (neutral) environment where QUnit will be running

Point 3: Go through core modules created/maintained by Wikimedia develoeprs, line by line, and make sure there's suffecient test suits.

== Extend / Integrate QUnit ==

Point 4: Create a nice way for extensions to state that a module should be loaded on Unit-test page and register a js file with qunit tests which should be executed.

Point 5: Figure out what needs to be done to make a QUnit test page into a TestSwarm-able thing through SVN sending periodic tests to clients  – without requiring users to have a TestSwarm - a vanilla QUnit page should stay available.

== Stuff for TestSwarm ==

Point 6: Set up a local TestSwarm

Point 7: Set up at Toolserver (if possible).

Point 8: IRC Bot for reporting breakage ?

Point 9: Set up in WMF (probably a wmf-like wiki running trunk, perhaps multiple (one on trunk, one of wmfbranch) see [1])

Point 10: Whatever I forgot ?


--
Krinkle

[1] http://www.mediawiki.org/wiki/WMF_Projects/Virtualization_cluster
Comment 9 Krinkle 2011-05-10 18:08:33 UTC
Part of point 1:

r87830.
Comment 10 Brion Vibber 2011-05-10 21:29:57 UTC
r87830 breaks configuration settings and whatnot by making Map.set() exit early for no apparent reason. Breaks scripts using various config settings, causes scripts to be loaded in debug mode when non-debug mode is requested, and probably breaks other stuff.

Needs immediate revert.
Comment 11 Brion Vibber 2011-05-10 21:38:16 UTC
Reverted in r87846.
Comment 12 Brion Vibber 2011-05-10 21:44:57 UTC
Per IRC this is now fixed in Krinkle's work tree, so it'll be back (fixed) with the next commit on this bug. Yay!
Comment 13 Krinkle 2011-05-10 21:56:43 UTC
Further implementation of a QUnit-backend test suite is tracked/discussed under bug 28915.
Comment 14 Krinkle 2011-05-16 21:31:09 UTC
(In reply to comment #12)
> Per IRC this is now fixed in Krinkle's work tree, so it'll be back (fixed) with
> the next commit on this bug. Yay!

Yep! r88144/r88149 removed the old test suite, and the new QUnit module is now available in resource loader.

Gadgets can access qunit by wrapper their test unit initialization in:

mw.loader.using( 'jquery.qunit', function(){

 /* qunit test suite here */

});

As with all Qunit testing, the following elements must be on the page. Create them in a wiki article or insert them dynamically:

<h1 id="qunit-header">Name of my Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
Comment 15 Helder 2011-05-17 00:18:40 UTC
(In reply to comment #14)
> (In reply to comment #12)
> Yep! r88144/r88149 removed the old test suite, and the new QUnit module is now
> available in resource loader.

Do this mean that Bug 28873 can be closed since the code doesn't exists anymore?

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


Navigation
Links