Markus Glaser <gla...@hallowelt.biz> writes:

> 1) Where are the tests located? I suggest for core to put them into
> maintenance/tests/selenium. That is where they are now. For extensions
> I propse a similar structure, that is <extensiondir>/tests/selenium.

Sounds fine.

In the same way, since maintenance/tests contains tests that should be
run using PHPUnit, we can say that <extensiondir>/tests will contain
tests that should be run using PHPUnit.

> Alternatively, we could use the word "Selenium" somewhere
> in there in order to be able to divide between unit and selenium
> tests.

I think putting them in the selenium directory (or the “Se” directory)
is sufficient.

> 3) How does the framework know there are tests?

Can I suggest that the framework can see that an extension has tests
simply by the presence of the <extensiondir>/tests directory containing a
<Extension>*TestSuite.php file?

The <extensiondir>/tests/<Extension>TestSuite.php file should define a
class using the name <Extension>TestSuite which has a static method
suite().  See the PHPUnit documentation at http://bit.ly/b9L50r for how
this is set up.

This static suite() method should take care of letting the autoloader
know about any test classes so the test classes are only available
during testing.

So, for your example using PagedTiffHandler, there would be the files:

    PagedTiffHandler/tests/PagedTiffHandlerTestSuite.php
    PagedTiffHandler/tests/PagedTiffHandlerUploadsTestSuite.php

> 4) Which tests should be executed?

By default all the test suites in <extensiondir>/tests should be run.

It is should be possible to specify which particular test to run by
using whatever command line arguments to the CLI.

This seems better to me than defining a new global.  If some tests
should only be run rarely, that information can be put in the TestSuite
class for te extension.

In this way, I think it is possible to remove all the $wgSelenium*
variables from the DefaultSettings.php file.

(I plan to do something similar with the $wgParserTest* variables as
well — these sorts of things don't seem like they belong in Core.)

Mark.

-- 
http://hexmode.com/

Embrace Ignorance.  Just don't get too attached.

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

Reply via email to