Skip to content

Test Environments

Marcel Pfotenhauer edited this page Sep 3, 2019 · 9 revisions

Test Environments

Neodymium supports test environments that can be utilized using a Remote WebDriver. Those test environment can be a self hosted Selenium Grid or some test environment service like SauceLabs or TestingBot. These services are cloud based browser provider that you can use to execute browser based tests. They provide real and emulated devices like personal computer, 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.

##Credentials 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 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

NOTE: Please note the property key names contain saucelabs or testingbot 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 executed the 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

SauceLabs: How to find your credentials

In your account setting on SauceLabs you can find you 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.


Access Key

TestingBot: How to find your credentials

In your account on TestingBot you can find you 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.


Access Key

Proxy setup

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

Browser specific test environment configuration

Sometimes it is cumbersome to configure a certain browser on a test environment. Fortunately, you can use the configuration helpers of SauceLabs and TestingBot 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 BrowserConfigurationMapper class.

Property name Type Usage SauceLabs TestingBot
browserName String name of the browser e.g. "safari" supported supported
deviceName String (mobile) device used for testing e.g. "iPhone Xs Max" supported supported
deviceOrientation String orientation of the device e.g. "landscape" supported not supported
idleTimeout int time after an idle remote driver is closed in seconds e.g. "60" supported renamed: "idletimeout"
maxDuration int maximum runtime of the remote driver in seconds e.g. "1800" supported renamed: "maxduration"
platformName String OS/platform the browser is running on e.g. "iOS" supported supported
screenResolution String width and height separated by x e.g. "1200x900" supported renamed: "screen-resolution"
seleniumVersion String version of Selenium used within the environment supported renamed: "selenium-version"
version String browser/system version e.g. "12.2" supported supported

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.

Example configuration

##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
Clone this wiki locally