Skip to content

Neodymium configuration properties

Bernd Weigel edited this page Jun 10, 2024 · 15 revisions

Configuration via properties files

Neodymium combines a couple of frameworks that all have their own configuration needs which also effects test execution. Most of these properties can be defined/overwritten with environment variables. However since this is an awkward way of configuration we introduced the file: config/neodymium.properties The file contains a collection of properties that is used to configure some aspects of the used frameworks. It doesn't cover all of the possible configurations for all the frameworks we've integrated. Have a look at this file since it lists all supported properties as well as their default values and its purpose. We use Owner a framework to write powerful and flexible properties in order to avoid writing all the boilerplate code. If you are in need of your own set of global properties we encourage you to give Owner a try.

Neodymium properties

The following properties can be configured in the config/neodymium.properties file. Those properties can be accessed via Neodymium.configuration().[propertyGetterMethod]().

Those properties can be overwritten in the following way/order (The sytem environment overwrites everything):

  • the standard way via config/neodymium.properties
  • configure your development environment via config/dev-neodymium.properties (This file should not be committed)
  • a temporary properties file to change the configuration for a single test case during runtime (ConfigFactory.setProperty("neodymium.temporaryConfigFile", "file:PATH/[temporaryFile].properties")
  • System.getProperties() (passing configuration properties via the -D switch on command line)
  • System.getenv() (set configuration properties via your your system environment e.g. PATH)

Url properties

Property Default value Description
neodymium.url <none> The URL of the web site to test
neodymium.url.protocol <none> The protocol used to access the site
neodymium.url.host <none> The host encoded in the URL
neodymium.url.path / The path on the site that is used as test entry point
neodymium.url.site <none> The site/channel part of the url

Localization

Property Default value Description
neodymium.locale en_US The locale that should be used to lookup translations in localization feature
neodymium.localization.file config/localization.yaml Path to the YAML formatted file that contains localized (translated) data for the site

Basic authentication properties

Property Description
neodymium.basicauth.username Username that should be used for basic authentification
neodymium.basicauth.password Password that should be used for basic authentification

Selenide properties

Property Default value Description
neodymium.selenide.timeout 3000 (ms) How long should Selenide wait to match a condition
neodymium.selenide.fastSetValue false The values of input field will be set via JavaScript
neodymium.selenide.clickViaJs false The clicks will be executed via JavaScript

Debugging properties

Property Default value Description
neodymium.debugUtils.highlight false Should elements highlighted that are selected by Selenide
neodymium.debugUtils.highlight.duration 100 (ms) How long should an element be highlighted
neodymium.junit.viewmode tree How to display test execution in Eclipse JUnit view. tree - a hierarchical representation, flat - a flat list of tests

Neodymium context properties

Responsive design breakpoints. Determines at which page width a site is considered to be displayed on a small, medium, large oder extra large device.

Property Default value Description
neodymium.context.device.breakpoint.small 576 (pixel) Maximum browser width for extra small devices (0 - 576)
neodymium.context.device.breakpoint.medium 768 (pixel) Maximum browser width for small devices (577 - 768)
neodymium.context.device.breakpoint.large 992 (pixel) Maximum browser width for medium devices (769 - 992)
neodymium.context.device.breakpoint.xlarge 1200 (pixel) Maximum browser width for large devices (993 - 1200)

JavaScriptUtils properties

Property Default value Description
neodymium.javaScriptUtils.timeout 2000 (ms) The amount of time to wait until JavaScript is considered to finished execution. Used by "until" function of JavaScriptUtils.
neodymium.javaScriptUtils.pollingInterval 200 The interval at which "until" function checks whether conditions are fulfilled.
neodymium.javaScriptUtils.jQueryIsRequired true Indicates that jQuery must be on the page and available in order to count the site as loaded.
neodymium.javaScriptUtils.loading.animationSelector Designed to select a loading animation to indicate if site loading has finished or not.

Proxy configuration properties

HTTP proxy settings. Specify host and port of the proxy server and whether it should be used at all. If the proxy requires user authentication, make sure to provide the credentials needed. You may also configure a comma separated list of hosts that can be used directly, thus bypassing the proxy. Note that the host definitions are interpreted as regular expressions so ensure proper use of escape characters. Beside the config/neodymium.properties file the proxy configuration can be also be configured within a config/proxy.properties file. In case you need a separate file for CI environments.

Property Description
neodymium.proxy Decide whether or not a proxy is used (Default: false)
neodymium.proxy.host The host of the proxy
neodymium.proxy.port The port of the proxy
neodymium.proxy.bypassForHosts The hosts that bypass the proxy
neodymium.proxy.socket.userName The socket username of the proxy
neodymium.proxy.socket.password The socket password of the proxy
neodymium.proxy.socket.version The socket version of the proxy

Local proxy configuration properties

The following settings can be used to setup an embedded local proxy. The proxy can be used with a (self signed) certificate to authenticate the proxy that acts as a man in the middle(MITM). This certificate can be provided by the user or generated on the fly.

Property Default value Description
neodymium.localproxy false Create a local proxy to use it for basic authentication, header manipulations or similar things
neodymium.localproxy.certificate false Should a self signed certificate be used for the MITM proxy
neodymium.localproxy.certificate.generate true Decides if a certificate should be created on the fly
neodymium.localproxy.certificate.archiveFile ./config/Certificates.p12 The path to the certificate archive file that contains the root certificate for the MITM proxy
neodymium.localproxy.certificate.archivetype PKCS12 The type of the certificate archive
neodymium.localproxy.certificate.name The name of the root certificate for the MITM proxy
neodymium.localproxy.certificate.password The password of the root certificate for the MITM proxy

Browser behavior configuration

The browser behavior describes how the browser in general conducts during test. There are a couple of properties that you can use to alter that.

Property Description
neodymium.webDriver.reuseDriver a boolean property indicating whether to use a single driver instance for all tests (defaults to false)
neodymium.webDriver.maxReuse The number of reuses. If not specified or set below 1 the driver will be reused unlimited times. Setting the property to 1 means that the driver is reused once, so the web driver is used twice in total.
neodymium.webDriver.keepBrowserOpen a boolean property indicating whether to keep browser open after test has finished
NOTE: The WebDriver process might stay alive even if you close the browser afterwards
neodymium.webDriver.keepBrowserOpenOnFailure a boolean property indicating whether to keep the browser instance open only if the test fails
NOTE: The WebDriver process might stay alive even if you close the browser afterwards
neodymium.webDriver.firefox.legacyMode a boolean property indicating whether to run Firefox WebDrivers in "legacy" mode
Note: The legacy mode does not work with Firefox 48+. Use Firefox 45 ESR

Testfiltering configuration

In some projects, it's required to execute only the test, the class name, method name, and dataset id of which match the specific regex. To do so, you have to define neodymium.testNameFilter inside of config/neodymium.properties .

Credentials properties

Since we support plattforms like SauceLabs and BrowserStack there is a need to store credentials to access their service. In order to use these service you need to provide an URL as well as credentials to access. Both platforms use Selenium Grid protocol which is used to remote control a web browser in the cloud. You can also setup your own browser cloud with Selenium Grid.

Look at the credentials template. It's designed for accessing only browser automation services which usually use an URL, username and a password respective access key. These credentials are needed to access the services that allow you to use remote browser to execute your tests. SauceLabs usually doesn't use a password. They use an access key which is different from your password and which can be accessed through their web site. So keep that in mind if you want to use such services.

In the example below there is an Firefox configuration that references the SauceLabs account from credentials file. The connection is made by the key pattern of the credentials file. browserprofile.testEnvironment.saucelabs.* defines a test environment named saucelabs which can be referenced in the browser settings as a testEnvironment. That actually means that in order to create that particular web driver defined in browser.properties the information from credentials.properties will be taken into account. Note: There is only a credentials.properties.template file which needs to be renamed to credentials.properties

config/credentials.properties

## Sauce Labs Credentials
browserprofile.testEnvironment.saucelabs.url = https://ondemand.saucelabs.com:443/wd/hub
browserprofile.testEnvironment.saucelabs.username = MyAccount 
browserprofile.testEnvironment.saucelabs.password = secret

config/browser.properties

browserprofile.FF_1024x768.name = Firefox
browserprofile.FF_1024x768.browser = firefox
browserprofile.FF_1024x768.browserResolution = 1024x768
browserprofile.FF_1024x768.testEnvironment = saucelabs
Clone this wiki locally