User:Dan Nessett/Technical/Notes on Regresssion Testing: Difference between revisions
Jump to navigation
Jump to search
imported>Dan Nessett (New page: ==Selenium== ==SeleniumFramework== ==General Notes== * For linux wmctrl allows the manipulation of windows from the command line. This is useful for running tests that start up a brow...) |
No edit summary |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{AccountNotLive}} | |||
==Selenium== | ==Selenium== | ||
Line 10: | Line 11: | ||
<pre>sudo apt-get install wmctrl</pre> | <pre>sudo apt-get install wmctrl</pre> | ||
==Notes on getting MW Selenium worked examples to work== | |||
===Installing the necessary software=== | |||
* Need to install PHPUnit. Use pear (comes installed with latest version of PHP) | |||
<pre>sudo pear upgrade pear | |||
sudo pear channel-discover pear.phpunit.de | |||
sudo pear install phpunit/PHPUnit</pre> | |||
Pear files are in (Ubuntu): /usr/share/php/PEAR | |||
PHPUnit files are in (Ubuntu): /usr/share/php/PHPUnit | |||
* Need to install Selenium | |||
:* Selenium Remote Control (RC) is found at: http://seleniumhq.org/download/ | |||
:* Need java jvm installed (at least version 1.5) | |||
:* Selenium RC only requires running selenium-server: | |||
:* <pre>java -jar /path/to/selenium-server.jar</pre> | |||
:* Selenium-IDE is also found at: http://seleniumhq.org/download/ | |||
:* It is a plugin for Firefox (only works on Firefox). | |||
* Need to install Testing/Selenium: | |||
<pre>sudo pear install Testing_Selenium</pre> | |||
* You may need to specify a specific version. To find out the most recent verion: | |||
<pre>pear remote-info Testing_Selenium</pre> | |||
===Setting up RunSeleniumTests.php (for Ubuntu)=== | |||
*''Make sure the require_once() of PagedTiffHandler in LocalSetings.php comes'' '''after''' ''the setting of $wgFileExtensions; otherwise that setting will clobber the addtion of .tiff and .tif by PagedTiffHandler'' | |||
* Copy the file .../tests/selenium/LocalSeleniumSettings.php.sample to .../tests/selenium/LocalSeleniumSettings.php | |||
* Edit LocalSeleniumSettings.php and change the line: | |||
: <pre>set_include_path( get_include_path() . PATH_SEPARATOR . 'PEAR' );</pre> | |||
:to read: | |||
:<pre>set_include_path( get_include_path() . PATH_SEPARATOR . '/usr/share/php/PEAR' );</pre> | |||
* In the file LocalSeleniumSettings.php, make the following modifications (leave the other lines alone): | |||
:<pre>$wgSeleniumTestsSeleniumHost = 'http://localhost';</pre> | |||
:<pre>$wgSeleniumTestsWikiUrl = 'http://localhost/<relative URL of wiki>';</pre> | |||
:For example, if in /etc/apache2/sites-enabled/000-default the directory relative URL to all wikis is: | |||
:<pre>Alias /mediawiki/ "/usr/local/src/mediawiki/"</pre> | |||
:and the specific wiki containing the selenium test directory is: | |||
:<pre>/usr/local/src/mediawiki/CZ_RF_1_13_2</pre> | |||
:then $wgSeleniumTestsWikiUrl should be set to: | |||
:<pre>$wgSeleniumTestsWikiUrl = 'http://localhost/mediawiki/CZ_refactor_1_13_2/phase3';</pre> | |||
: Set the following variables to the db user and pw | |||
:<pre>$wgSeleniumTestsWikiUser = '';</pre> | |||
:<pre>$wgSeleniumTestsWikiPassword = '';</pre> | |||
:Set: | |||
:<pre>$wgSeleniumTestsBrowsers['firefox'] = '*firefox /usr/bin/firefox';</pre> | |||
:<pre>$wgSeleniumTestsUseBrowser = 'firefox';</pre> | |||
:Set the tests. Assuming you have loaded the PagedTiffHandler extension (and uploaded the file Multipage.tiff to the Images namespace as Multipage.tiff) | |||
:<pre>$wgSeleniumTestIncludes = array(</pre> | |||
:<pre>'selenium/SimpleSeleniumTest.php',</pre> | |||
:<pre>'/<path/to/wiki>/phase3/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php'</pre> | |||
===Some useful URLs=== | |||
* Netbeans, Selenium and PHPUnit: <pre>http://netbeans.org/kb/docs/php/phpunit.html</pre> | |||
===Selenium meeting notes 5/14/2010=== | |||
* The Selenium framework testing code in the latest trunk of MW (r66751 ) is designed to work with 1.13 and has been tested on 1.13 and 1.15. | |||
* In order to allow tests to dynamically configure the wiki, create an extension that is called by a hook at the end of LocalSettings. This extension then sets any necessary global variables and returns. | |||
* Each test needs to establish the db in a state suitable for testing. How this will be accomplished is yet undefined. | |||
* Discussion of the Selenium Framework for MW will be conducted on Wikitech-l | |||
* There exists RC scripts for the Selenium-Grid machines. These will be checked into the main trunk. | |||
* Some relevant links from Ryan Lane: | |||
:* http://grid.tesla.usability.wikimedia.org/console | |||
:* http://grid.tesla.usability.wikimedia.org:4444 | |||
:* http://www.mediawiki.org/wiki/Selenium | |||
:* http://www.mediawiki.org/wiki/SeleniumFramework |
Latest revision as of 02:39, 22 November 2023
The account of this former contributor was not re-activated after the server upgrade of March 2022.
Selenium
SeleniumFramework
General Notes
- For linux wmctrl allows the manipulation of windows from the command line. This is useful for running tests that start up a browser window (and console, such as Selenium), since it is possible to create a wrapper that starts up the browser and then immediately minimizes its window. This keeps the main window uncluttered during test runs. To install wmctrl on Ubuntu:
sudo apt-get install wmctrl
Notes on getting MW Selenium worked examples to work
Installing the necessary software
- Need to install PHPUnit. Use pear (comes installed with latest version of PHP)
sudo pear upgrade pear sudo pear channel-discover pear.phpunit.de sudo pear install phpunit/PHPUnit
Pear files are in (Ubuntu): /usr/share/php/PEAR PHPUnit files are in (Ubuntu): /usr/share/php/PHPUnit
- Need to install Selenium
- Selenium Remote Control (RC) is found at: http://seleniumhq.org/download/
- Need java jvm installed (at least version 1.5)
- Selenium RC only requires running selenium-server:
java -jar /path/to/selenium-server.jar
- Selenium-IDE is also found at: http://seleniumhq.org/download/
- It is a plugin for Firefox (only works on Firefox).
- Need to install Testing/Selenium:
sudo pear install Testing_Selenium
- You may need to specify a specific version. To find out the most recent verion:
pear remote-info Testing_Selenium
Setting up RunSeleniumTests.php (for Ubuntu)
- Make sure the require_once() of PagedTiffHandler in LocalSetings.php comes after the setting of $wgFileExtensions; otherwise that setting will clobber the addtion of .tiff and .tif by PagedTiffHandler
- Copy the file .../tests/selenium/LocalSeleniumSettings.php.sample to .../tests/selenium/LocalSeleniumSettings.php
- Edit LocalSeleniumSettings.php and change the line:
set_include_path( get_include_path() . PATH_SEPARATOR . 'PEAR' );
- to read:
set_include_path( get_include_path() . PATH_SEPARATOR . '/usr/share/php/PEAR' );
- In the file LocalSeleniumSettings.php, make the following modifications (leave the other lines alone):
$wgSeleniumTestsSeleniumHost = 'http://localhost';
$wgSeleniumTestsWikiUrl = 'http://localhost/<relative URL of wiki>';
- For example, if in /etc/apache2/sites-enabled/000-default the directory relative URL to all wikis is:
Alias /mediawiki/ "/usr/local/src/mediawiki/"
- and the specific wiki containing the selenium test directory is:
/usr/local/src/mediawiki/CZ_RF_1_13_2
- then $wgSeleniumTestsWikiUrl should be set to:
$wgSeleniumTestsWikiUrl = 'http://localhost/mediawiki/CZ_refactor_1_13_2/phase3';
- Set the following variables to the db user and pw
$wgSeleniumTestsWikiUser = '';
$wgSeleniumTestsWikiPassword = '';
- Set:
$wgSeleniumTestsBrowsers['firefox'] = '*firefox /usr/bin/firefox';
$wgSeleniumTestsUseBrowser = 'firefox';
- Set the tests. Assuming you have loaded the PagedTiffHandler extension (and uploaded the file Multipage.tiff to the Images namespace as Multipage.tiff)
$wgSeleniumTestIncludes = array(
'selenium/SimpleSeleniumTest.php',
'/<path/to/wiki>/phase3/extensions/PagedTiffHandler/selenium/PagedTiffHandler_tests.php'
Some useful URLs
- Netbeans, Selenium and PHPUnit:
http://netbeans.org/kb/docs/php/phpunit.html
Selenium meeting notes 5/14/2010
- The Selenium framework testing code in the latest trunk of MW (r66751 ) is designed to work with 1.13 and has been tested on 1.13 and 1.15.
- In order to allow tests to dynamically configure the wiki, create an extension that is called by a hook at the end of LocalSettings. This extension then sets any necessary global variables and returns.
- Each test needs to establish the db in a state suitable for testing. How this will be accomplished is yet undefined.
- Discussion of the Selenium Framework for MW will be conducted on Wikitech-l
- There exists RC scripts for the Selenium-Grid machines. These will be checked into the main trunk.
- Some relevant links from Ryan Lane: