-
Notifications
You must be signed in to change notification settings - Fork 99
3.1. Build Server Selenium Configuration
The Selenium configuration (e.g. what browser on what platform) to use when testing websites in a jUnit suite via the HsacFitNesseRunner
(e.g. nl.hsac.fitnesse.fixture.FixtureDebugTest
) can be overridden by using Java system properties. This allows different configurations on a build server to test with different browsers, without requiring different Wiki content, but only requiring a different build configuration.
Possible configurations | |
Running the tests on a Selenium grid using a specific browser | set seleniumGridUrl and seleniumBrowser |
Running the tests on a Selenium grid by specifying the required capabilities of the browser | set seleniumGridUrl and seleniumCapabilities |
Running the tests on a Selenium grid by specifying the required capabilities of the browser using JSON | set seleniumGridUrl and seleniumJsonCapabilities (and NOT seleniumCapabilities ) |
Running the tests on the build server (i.e. the machine running the jUnit test) | set seleniumBrowser (and NOT seleniumGridUrl ) |
Running the tests on the build server (i.e. the machine running the jUnit test) using a WebDriver class directly | set seleniumDriverClass (and NOT seleniumBrowser or seleniumGridUrl ) |
The latter option (running the test on the build server and specifying a WebDriver class directly) is useful when the driver is accessible on the build server, but you never run the wiki the same OS normally so it is not included in the wiki installation. For instance to use Chrome Headless to run tests on Linux build server when no one in the team runs on Linux locally; so no Linux webdrivers are included but they are available on the build server.
The value of seleniumCapabilities
must be in the format: key:value(,key:value)*, for instance: browserName:internet explorer, platform:Windows 8.1, version:11
.
Please note that if any capability value or key contains a space the entire property’s value must be enclosed in double quotes (i.e. "), to ensure the whole string (and not just the part up to the first space) is seen as the value for seleniumCapabilities
.
The value of seleniumJsonCapabilities
can use single quotes instead of the double quotes normally used in JSON. For instance: {'browserName':'chrome','chromeOptions':{'args':['--ignore-certificate-errors']}}
.
Besides the Selenium browser to use, the default timeout (used by BrowserTest when ‘’seconds before timeout value’’ is not included in scripts) can be configured using the property seleniumDefaultTimeout
.
A suite can be run using Selenium drivers from the cloud service Sauce Labs by setting a seleniumGridUrl
pointing to their Selenium grid, containing your username and access key, and a seleniumCapabilities
describing the browser and platform you would like to use. Which capabilities your run requires can be determined using Sauce Labs’ Platforms Configurator. The HTML report generate by such a run will embed the screencast created by Sauce Labs (as can be seen in the example reports in release 1.6.1).
So to run with Internet Explorer 11 on Windows 8.1, for instance, add the following options to the java process running the tests:
-DseleniumGridUrl=http://<username>:<accessKey>@ondemand.saucelabs.com:80/wd/hub -DseleniumCapabilities="browserName:internet explorer, platform:Windows 8.1, version:11"
In a Jenkins Maven-based build these properties can be configured as MAVEN_OPTS
(e.g. -DseleniumBrowser=chrome
) for the build. When using TeamCity these properties can be set as (system) build parameters for the project or configuration.