5 * @copyright Copyright © Wikimedia Deuschland, 2009
6 * @author Hallo Welt! Medienwerkstatt GmbH
7 * @author Markus Glaser
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
25 define( 'MEDIAWIKI', true );
26 define( 'SELENIUMTEST', true );
28 // Here, you can override standard setting
29 if ( file_exists( 'selenium/LocalSeleniumSettings.php' ) ) {
30 include_once 'selenium/LocalSeleniumSettings.php';
32 echo "You must provide local settings in LocalSeleniumSettings.php\n";
37 if ( $wgSeleniumTestsRunMode == 'cli' && php_sapi_name() != 'cli' ) {
38 echo "Must be run from the command line.\n";
42 // Get command line parameters
43 if ( $wgSeleniumTestsRunMode == 'cli' ) {
44 require_once( dirname( __FILE__
) . '/../commandLine.inc' );
45 if ( isset( $options['help'] ) ) {
47 MediaWiki $wgVersion Selenium Framework tester
48 Usage: php RunSeleniumTests.php [options...]
50 --port=<TCP port> Port used by selenium server to accept commands
51 --help Show this help message
56 if ( isset( $options['port'] ) ) {
57 $wgSeleniumServerPort = (int) $options['port'];
61 // requires PHPUnit 3.4
62 require_once 'Testing/Selenium.php';
63 require_once 'PHPUnit/Framework.php';
64 require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
66 // include seleniumTestsuite
67 require_once 'selenium/SeleniumTestHTMLLogger.php';
68 require_once 'selenium/SeleniumTestConsoleLogger.php';
69 require_once 'selenium/SeleniumTestListener.php';
70 require_once 'selenium/Selenium.php';
71 require_once 'selenium/SeleniumTestSuite.php';
72 require_once 'selenium/SeleniumTestCase.php';
74 $result = new PHPUnit_Framework_TestResult
;
75 switch ( $wgSeleniumTestsRunMode ) {
77 $logger = new SeleniumTestHTMLLogger
;
80 $logger = new SeleniumTestConsoleLogger
;
84 $result->addListener( new SeleniumTestListener( $logger ) );
86 $wgSeleniumTestSuites = array();
89 // Todo: include automatically
90 if ( is_array( $wgSeleniumTestIncludes ) ) {
91 foreach ( $wgSeleniumTestIncludes as $include ) {
92 include_once $include;
97 foreach ( $wgSeleniumTestSuites as $suite ) {
98 $suite->run( $result );