User:Dan Nessett/Technical/Notes on Regresssion Testing
Jump to navigation
Jump to search
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)
- Edit RunSeleniumTests.php and uncomment the line:
set_include_path( get_include_path() . PATH_SEPARATOR . '/usr/share/php/PEAR' );
- Create the file: LocalSeleniumSettings.php and insert:
// Hostname of selenium server $wgSeleniumTestsSeleniumHost = 'http://localhost'; // URL of the wiki to be tested. $wgSeleniumTestsWikiUrl = 'http://localhost'; // Wiki login. Used by Selenium to log onto the wiki $wgSeleniumTestsWikiUser = ''; $wgSeleniumTestsWikiPassword = ''; // Common browsers on Windows platform // Use the *chrome handler in order to be able to test file uploads $wgSeleniumTestsBrowsers['firefox'] = '*firefox c:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe'; $wgSeleniumTestsBrowsers['ff-chrome'] = '*chrome c:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe'; $wgSeleniumTestsBrowsers['iexplorer'] = '*iexploreproxy'; // Actually, use this browser $wgSeleniumTestsUseBrowser = 'ff-chrome';
Edit this text and insert the name ($wgSeleniumTestsWikiUser) and password ($wgSeleniumTestsWikiPassword) of the wiki user under which the tests will run.
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: