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 );
29 $wgSeleniumTestsRunMode = 'cli';
30 if ( $wgSeleniumTestsRunMode == 'cli' && php_sapi_name() != 'cli' ) {
31 echo 'Must be run from the command line.';
34 // include path and installation instructions
36 // URL: http://localhost/tests/RunSeleniumTests.php
37 // set_include_path( get_include_path() . PATH_SEPARATOR . './PEAR/' );
39 // Hostname of selenium server
40 $wgSeleniumTestsSeleniumHost = 'http://localhost';
42 // URL of the wiki to be tested.
43 $wgSeleniumTestsWikiUrl = 'http://localhost';
45 // Wiki login. Used by Selenium to log onto the wiki
46 $wgSeleniumTestsWikiUser = 'WikiSysop';
47 $wgSeleniumTestsWikiPassword = 'password';
49 // Common browsers on Windows platform
50 // Use the *chrome handler in order to be able to test file uploads
51 // further solution suggestions: http://www.brokenbuild.com/blog/2007/06/07/testing-file-uploads-with-selenium-rc-and-firefoxor-reducing-javascript-security-in-firefox-for-fun-and-profit/
52 // $wgSeleniumTestsBrowsers['firefox'] = '*firefox c:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe';
53 $wgSeleniumTestsBrowsers['firefox'] = '*chrome c:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe';
54 $wgSeleniumTestsBrowsers['iexplorer'] = '*iexploreproxy';
56 // Actually, use this browser
57 $wgSeleniumTestsUseBrowser = 'firefox';
59 // requires PHPUnit 3.4
60 require_once 'Testing/Selenium.php';
61 require_once 'PHPUnit/Framework.php';
62 require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
64 // include uiTestsuite
65 require_once 'selenium/SeleniumTestHTMLLogger.php';
66 require_once 'selenium/SeleniumTestConsoleLogger.php';
67 require_once 'selenium/SeleniumTestListener.php';
68 require_once 'selenium/Selenium.php';
69 require_once 'selenium/SeleniumTestSuite.php';
70 require_once 'selenium/SeleniumTestCase.php';
72 $result = new PHPUnit_Framework_TestResult
;
73 switch ( $wgSeleniumTestsRunMode ) {
75 $logger = new SeleniumTestHTMLLogger
;
78 $logger = new SeleniumTestConsoleLogger
;
82 $result->addListener( new SeleniumTestListener( $logger ) );
84 $wgSeleniumTestSuites = array();
86 // Todo: include automatically
87 # include_once '<your tests>';
89 // Here, you can override standard setting
90 if ( file_exists( 'LocalSeleniumSettings.php' ) ) {
91 include_once 'LocalSeleniumSettings.php';
95 foreach ( $wgSeleniumTestSuites as $suite ) {
96 $suite->run( $result );