-
Notifications
You must be signed in to change notification settings - Fork 11
Test Environments
Neodymium supports test environments that can be utilized using a Remote WebDriver. Those test environments can be a self hosted Selenium Grid, or some test environment service like SauceLabs, TestingBot or Browserstack. These services are cloud based browser providers that you can use to execute browser based tests. They provide real and emulated devices like personal computers, tablets, and cell phones with different configurations. You can choose the operating system as well as the browser that should be used for test execution. With our multi browser support we are able to execute the browser based tests automatically in the cloud.
To be able to use a test environment service for test execution, you need to provide an account in the file config/credentials.properties
. Instead of entering your password, you need to provide some kind of access key. The credentials key can be obtained from the accounts user settings on their website.
In case you need to overwrite those credentials within your development environment, you can do it in the following way:
- the standard way via
config/credentials.properties
- configure your development environment via
config/dev-credentials.properties
(This file should not be committed)
# Test Environment Credentials
##SauceLabs
browserprofile.testEnvironment.saucelabs.url = https://ondemand.saucelabs.com:443/wd/hub
browserprofile.testEnvironment.saucelabs.username = SAUCELAB_USERNAME
browserprofile.testEnvironment.saucelabs.password = SAUCELAB_ACCESS_KEY
##TestingBot
browserprofile.testEnvironment.testingbot.url = https://hub.testingbot.com/wd/hub
browserprofile.testEnvironment.testingbot.username = TESTINGBOT_KEY
browserprofile.testEnvironment.testingbot.password = TESTINGBOT_SECRET
##Browserstack
browserprofile.testEnvironment.browserstack.url = https://hub-cloud.browserstack.com/wd/hub
browserprofile.testEnvironment.browserstack.username = BROWSERSTACK_KEY
browserprofile.testEnvironment.browserstack.password = BROWSERSTACK_KEY
NOTE: Please note the property key names contain saucelabs
, testingbot
, or browserstack
which will be used later on to reference that configuration.
In order to use a test environment based browser, you need to configure that specific browser in browser.properties
by adding the testEnvironment property.
Example: The following configuration will configure Google Chrome browsers of version 50.0 on SauceLabs and TestingBot. A test case that you annotate with @Browser("Chrome_SauceLabs")
and/or @Browser("Chrome_TestingBot")
will execute the test on SauceLabs and/or TestingBot.
##SauceLabs
browserprofile.Chrome_SauceLabs.name = Chrome 50@saucelabs
browserprofile.Chrome_SauceLabs.browser = chrome
browserprofile.Chrome_SauceLabs.version = 50.0
browserprofile.Chrome_SauceLabs.testEnvironment = saucelabs
##TestingBot
browserprofile.Chrome_TestingBot.name = Chrome 50@testingbot
browserprofile.Chrome_TestingBot.browser = chrome
browserprofile.Chrome_TestingBot.version = 50.0
browserprofile.Chrome_TestingBot.testEnvironment = testingbot
##Browserstack
browserprofile.Windows10Chrome_latest.name = Windows 10 Chrome latest
browserprofile.Windows10Chrome_latest.browserName = Chrome
browserprofile.Windows10Chrome_latest.version = latest
browserprofile.Windows10Chrome_latest.platform = Windows
browserprofile.Windows10Chrome_latest.platformVersion = 10
browserprofile.Windows10Chrome_latest.seleniumVersion = 3.14.0
browserprofile.Windows10Chrome_latest.testEnvironment = browserstack
In your account setting on SauceLabs, you can find your personal access key by clicking the show button that allows you to access their service in a programmatic way. Please keep your access key secret.
In your account on TestingBot, you can find your personal access key and secret that allows you to access their service in a programmatic way. You need to add them to the configuration above. Please keep your credentials secret.
You can access your account settings on Browserstack via https://www.browserstack.com/accounts/settings link. On the "Automate" card you will see your username and access key.
In case you need to access the test environment of your choice via a proxy, you are able to configure the proxy using the following settings.
# boolean to activate the proxy usage
browserprofile.testEnvironment.saucelabs.proxy = true
browserprofile.testEnvironment.saucelabs.proxy.host = PROXY_HOST
browserprofile.testEnvironment.saucelabs.proxy.port = 8500
browserprofile.testEnvironment.saucelabs.proxy.username = PROXY_USERNAME
browserprofile.testEnvironment.saucelabs.proxy.password = PROXY_PASSWORD
NOTE: Please note the property key names contain saucelabs
which will be used later on to reference that configuration
Sometimes it is cumbersome to configure a certain browser on a test environment. Fortunately, you can use the configuration helpers of https://wiki.saucelabs.com/display/DOCS/Platform+Configurator/#/ and https://testingbot.com/support/getting-started/browsers.html as a good starting point to create the needed Neodymium browser profiles.
Below you can find the test environment configurations we support at the moment. In case of uncertainties you can check out the https://github.com/Xceptance/neodymium-library/blob/master/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java class.
Property name | Type | Usage | SauceLabs | TestingBot | Browserstack |
---|---|---|---|---|---|
browserName | String | name of the browser e.g. "safari" | supported | supported | supported (alt: browser) |
deviceName | String | (mobile) device used for testing e.g. "iPhone Xs Max" | supported | supported | supported (alt: device) |
deviceOrientation | String | orientation of the device e.g. "landscape" | supported | not supported | supported |
idleTimeout | int | time after an idle remote driver is closed in seconds e.g. "60" | supported | renamed: "idletimeout" | supported (default 900s) |
maxDuration | int | maximum runtime of the remote driver in seconds e.g. "1800" | supported | renamed: "maxduration" | not supported (fixed on 2h) |
platformName | String | OS/platform the browser is running on e.g. "iOS" | supported | supported | renamed: "platform", (alt: os) |
screenResolution | String | width and height separated by x e.g. "1200x900" | supported | renamed: "screen-resolution" | renamed: "resolution" |
seleniumVersion | String | version of Selenium used within the environment | supported | renamed: "selenium-version" | supported |
version | String | browser/system version e.g. "12.2" | supported | supported | supported |
acceptInsecureCertificates | Boolean | not suported | not suported | not suported | renamed: "acceptSslCerts" |
NOTE: Since TestingBots naming scheme isn't consequent we sticked to the SauceLabs. Please configure the properties as named in the table above and Neodymium takes care of the mapping. NOTE: You can use [https://www.browserstack.com/automate/capabilities](capabilities generator) to see required configuration for the desired device
##SauceLabs
browserprofile.iphone8.name = iPhone 8 @SauceLabs
browserprofile.iphone8.browser = iphone
browserprofile.iphone8.browserName = Safari
browserprofile.iphone8.platformName = iOS
browserprofile.iphone8.platformVersion = 12.0
browserprofile.iphone8.deviceName = iPhone 8
browserprofile.iphone8.deviceOrientation = portrait
browserprofile.iphone8.testEnvironment = saucelabs
##TestingBot
browserprofile.iPhone_XS_TestingBot.name = iPhone XS @TestingBot
browserprofile.iPhone_XS_TestingBot.browser = iphone
browserprofile.iPhone_XS_TestingBot.browserName = safari
browserprofile.iPhone_XS_TestingBot.platformName = iOS
browserprofile.iPhone_XS_TestingBot.platformVersion = 12.1
browserprofile.iPhone_XS_TestingBot.deviceName = iPhone XS
browserprofile.iPhone_XS_TestingBot.testEnvironment = testingbot
##Browserstack
browserprofile.iPhone12.name = iPhone12
browserprofile.iPhone12.browserName = iphone12
browserprofile.iPhone12.platformVersion = 14
browserprofile.iPhone12.deviceName = iPhone 12
browserprofile.iPhone12.deviceOrientation = portrait
browserprofile.iPhone12.testEnvironment = browserstack
Overview
Neodymium features
- Neodymium configuration properties
- Neodymium context
- Utility classes
- Test data provider
- Test Environments
- Multi browser support
- Applitools Plugin
- Localization
- Highlight and Wait
- Advanced Screenshots
- Seperate Browser Sessions for Setup and Cleanup
Best practices and used frameworks
Special