[Wikitech-l] writing phpunit tests for extensions

2011-04-04 Thread Michael Dale
I had a bit of a documentation challenge approaching the problem of
writing phpunit test for extensions, mostly because many of the
extensions do this very differently and the manual did not have any
recommendations.

It appears many extension have custom bootstraping code ( somewhat hacky
path discovery and manual loading of core mediawiki files, and don't
necessarily register their tests in a consistent way.)

I wrote up a short paragraph of what I would recommend here:
http://www.mediawiki.org/wiki/Manual:Unit_testing#Writing_Unit_Test_for_Extensions

If that makes sense, I will try and open up some bugs on the extensions
with custom bootstraping code, and I would recommend we commit an
example test tests/phpunit/suite.extension.xml file for exclusively
running extension tests.

Eventually it would be ideal to be able to 'just test your extension'
from the core bootstraper (ie dynamically generate our suite.xml and
namespace the registration of extension tests) ... but for now at least
not having to wait for all the core tests as you write you extension
tests and some basic documentation on how to do seems like a step forward.

--michael

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] writing phpunit tests for extensions

2011-04-04 Thread Platonides
Michael Dale wrote:
 Eventually it would be ideal to be able to 'just test your extension'
 from the core bootstraper (ie dynamically generate our suite.xml and
 namespace the registration of extension tests) ... but for now at least
 not having to wait for all the core tests as you write you extension
 tests and some basic documentation on how to do seems like a step forward.
 
 --michael

If your tests are in just one file, you can simply pass it as a
parameter to tests/phpunit/phpunit.php



___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] writing phpunit tests for extensions

2011-04-04 Thread Michael Dale
On 04/04/2011 02:20 PM, Platonides wrote:
 Michael Dale wrote:
 Eventually it would be ideal to be able to 'just test your extension'
 from the core bootstraper (ie dynamically generate our suite.xml and
 namespace the registration of extension tests) ... but for now at least
 not having to wait for all the core tests as you write you extension
 tests and some basic documentation on how to do seems like a step forward.

 --michael
 If your tests are in just one file, you can simply pass it as a
 parameter to tests/phpunit/phpunit.php

that's cool. We should add that info to the phpunit.php --help output,
and to the unit testing wiki page.

--michael

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l