MediaWiki.org is great for extension authors, as far as it goes. Today, though, someone asked on #mediawiki how to create development branches for their extension in their SVN repo. I told him I didn't think it could be done — that he might have to use the SVN repo as a backend to push to from git or bzr — but I'm not sure that answer was correct.
Anyway, as I was writing about the UNIQ tracking bug, I thought of some documentation and support that we should try to get in place for extension developers. Since Sumana is creating a lot of good documentation about testing lately, that is where I started:
* What sort of things should they test?
* Can they have tests that will continue to work against the current parser and the next one?
* How can they write parser tests and unit tests to try out their code?
* How can they make sure that those tests are run on the test server? (I think this actually requires some work on the test server, but…)
Of course, that documentation would help more than just the extension writers who have “UNIQ” showing up in their output. What else could we do to support extension authors?
Mark.
On Sat, Jul 9, 2011 at 2:17 PM, Mark A. Hershberger < mhershberger@wikimedia.org> wrote:
MediaWiki.org is great for extension authors, as far as it goes. Today, though, someone asked on #mediawiki how to create development branches for their extension in their SVN repo. I told him I didn't think it could be done — that he might have to use the SVN repo as a backend to push to from git or bzr — but I'm not sure that answer was correct.
Should be able to just use the usual 'svn copy' from /trunk/extensions/whatev to /branches/mycoolext/whatev, unless permissions are locked down on the base 'branches' dir.
But managing/merging branches in SVN is always awkward; personally I tend to do temporary work branches in one-off git repositories.
Anyway, as I was writing about the UNIQ tracking bug, I thought of some
documentation and support that we should try to get in place for extension developers. Since Sumana is creating a lot of good documentation about testing lately, that is where I started:
What sort of things should they test?
Can they have tests that will continue to work against the current parser and the next one?
For now, keep using the existing parser test suite -- if we have to adapt/change things in the future we'll figure it out then. :)
phpunit, qunit tests will generally not depend on parser, so don't forget to test stuff in those ways if possible as well.
- How can they write parser tests and unit tests to try out their
code?
'Look at what other extensions do' is the best answer until somebody writes up some details, which would be super nice. :D
'Cite' is an example that has some parser tests; basically you need to provide a .txt file with the test cases in the same format as the core ones, and have a ... hook? Or a config var? that adds your file to the list of cases to run.
If your extension will require certain DB tables to be present to operate correctly, be sure to also handle the hook for adding your tables to the list to be copied. Cite doesn't have any tables, but there are other extensions like say Math or CheckUser that do. (Even if you don't have parser stuff, if your ext gets used during load/save operations etc you may need your tables copied if you want parser tests to work while you're enabled!)
- How can they make sure that those tests are run on the test server? (I think this actually requires some work on the test server, but…)
Whoever runs the test setup would need to add the extensions in.... no idea who/how at the moment. :)
-- brion
Brion Vibber wrote:
On Sat, Jul 9, 2011 at 2:17 PM, Mark A. Hershberger wrote:
- How can they write parser tests and unit tests to try out their
code?
'Look at what other extensions do' is the best answer until somebody writes up some details, which would be super nice. :D
'Cite' is an example that has some parser tests; basically you need to provide a .txt file with the test cases in the same format as the core ones, and have a ... hook? Or a config var? that adds your file to the list of cases to run.
Add to $wgParserTestFiles in the extension entry point: $wgParserTestFiles[] = dirname( __FILE__ ) . "/fileWithMyParserTests.txt";
- How can they make sure that those tests are run on the test server? (I think this actually requires some work on the test server, but…)
Whoever runs the test setup would need to add the extensions in.... no idea who/how at the moment. :)
LocalSettings.php Extensions installed in the wiki (ie. required by LocalSettings) have their tests run.
If you want some extension added for tests I recommend bugging hashar.
wikitech-l@lists.wikimedia.org