Manual:JavaScript unit testing: Difference between revisions
Appearance
Content deleted Content added
m cat: MediaWiki Development -> Testing |
some issues |
||
| Line 19: | Line 19: | ||
* On Toolserver: http://toolserver.org/~krinkle/testswarm/ |
* On Toolserver: http://toolserver.org/~krinkle/testswarm/ |
||
* For core modules a cronjob automatically populates tests under user [http://toolserver.org/~krinkle/testswarm/user/MediaWiki/ MediaWiki] (previously (pre-{{r|88431}}), [http://toolserver.org/~krinkle/testswarm/user/KrinkleBot/ KrinkleBot]). |
* For core modules a cronjob automatically populates tests under user [http://toolserver.org/~krinkle/testswarm/user/MediaWiki/ MediaWiki] (previously (pre-{{r|88431}}), [http://toolserver.org/~krinkle/testswarm/user/KrinkleBot/ KrinkleBot]). |
||
== Current Problems == |
|||
* The test runner page has no pointer to this documentation |
|||
* Test files often have the same name as the files they are testing, eg 'mediawiki.js' or 'jquery.colorUtil.js'. This makes code maintenance more difficult because bare filenames are often shown when navigating or working with code. Consider using the word 'test' visibly in the filename. |
|||
==Notes== |
==Notes== |
||
Revision as of 18:25, 24 May 2011
Unit testing in MediaWiki for its JavaScript code base is performed using the QUnit JavaScript Testing framework..
The unit tests are located in the tests/qunit directory[1]. Tests are organized into a directory structure that matches the directory structure of the code that they are testing. For example: The unit tests for file resources/mediawiki.util/mediawiki.util.js can be found in tests/qunit/suites/resources/mediawiki.util/mediawiki.util.js.
Running the unit tests
Run the unit tests from the browser.
- Browse to
http://location.of/wiki/tests/qunit.
Writing Unit Test for Modules
- Todo
Write Testable Code
- Todo
TestSwarm
- Todo
- On Toolserver: http://toolserver.org/~krinkle/testswarm/
- For core modules a cronjob automatically populates tests under user MediaWiki (previously (pre-r88431), KrinkleBot).
Current Problems
- The test runner page has no pointer to this documentation
- Test files often have the same name as the files they are testing, eg 'mediawiki.js' or 'jquery.colorUtil.js'. This makes code maintenance more difficult because bare filenames are often shown when navigating or working with code. Consider using the word 'test' visibly in the filename.