Howto - Running SMW Selenium Tests

From semantic-mediawiki.org
Jump to: navigation, search

Aim: Running SMW Selenium tests on a local SMW instance.

Back to SMW System Testing with Selenium.

Contents

Scenario

  • Here, the setup is the following:
    • We install one instance of MW and SMW.
    • MW contains the Selenium Framework.
    • SMW contains the SMW Selenium Tests.
    • The instance is the AUT (application under test). Could also be another wiki, but here the wiki itself is tested. The AUT is configured to be empty and the Vektor skin is used.
    • Selenium RC (remote control) is used by the Selenium Framwork to run the SMW Selenium Tests on the instance.

What you need

  • MediaWiki with Selenium Framework. The WMF Selenium Framework is available for later versions of MediaWiki, only. It also is still under development, especially in regard to Continuous Integration.
  • This Documentation uses MW 1.18alpha (r90094).
  • Selenium tests for SMW: They will be (not published yet) found in "MediaWiki/extensions/SemanticMediaWiki/tests/selenium/suites"
  • Selenium Server remote controlling the browsers: selenium-server.jar [1].

Procedure

Start Selenium Server on local machine

  • E.g., "java -jar .\selenium-server.jar"
  • More info at [2].
  • Hint: WMF-Selenium-Framework possibly does this.

Setup MediaWiki/Semantic MediaWiki on local machine

  • Configure LocalSettings.php of MediaWiki
  • Example:
# Selenium 
$wgEnableSelenium = true;
$wgSeleniumConfigFile = $IP . '/tests/selenium/selenium_mysettings_local.ini';
  • More information in [3].


  • Create configuration file
  • Add SMW test suite: testSuite[SMWSeleniumTestSuite] = "extensions/SemanticMediaWiki/tests/selenium/suites/SMWSeleniumTestSuite.php"
  • Example:
[SeleniumSettings]

browsers[firefox] 	= "*firefox"
browsers[iexplorer]     = "*iexploreproxy"
browsers[chrome] 	= "*chrome"
host 			= "localhost"
port 			= "4444"
wikiUrl 		= "http://localhost/MediaWiki1_18/"
username 		= "WikiSysop"
userPassword 		= "XXXXXX"
testBrowser 		= "firefox"

startserver	        =
stopserver		=
jUnitLogFile		=
runAgainstGrid	        = false

; To let the test runner start and stop the selenium server, it needs the full
; path to selenium-server.jar from the selenium-remote-control package.
seleniumserverexecpath = "C:\Users\b-kaempgen\Documents\Programme\selenium-server-1.0.3\selenium-server.jar"

testSuite[SMWSeleniumTestSuite] = "extensions/SemanticMediaWiki/tests/selenium/suites/SMWSeleniumTestSuite.php"

  • More information at [4]

Run SMW selenium tests

  • E.g., "php .\tests\RunSeleniumTests.php"
  • See [5] for more information.
  • Failure or sucess of tests/assertions is indicated in the console.

Hints/Tricks

Rerunning tests after failure

  • After a failure, pages might not have been deleted properly from the AUT.
  • WMF Selenium Framework provides a way to automatically create a clean wiki instance before running the tests. See more information at [6]. However, this does not seem to work properly, yet.
  • As a workaround: In order to re-run tests after a failure, create a backup from the database or use the Extension Nuke to delete all pages.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox