Skip to content

Configuration

There are multiple properties files located in src/main/resources:

  • api.properties - API test endpoints reference
  • config.properties - global test configuration
  • database.properties - database connection properties
  • email.properties - emailable reports config
  • testdata.properties - test user credentials

All the properties may be retrieved in a test using R class:

R.API.get("GetUserMethods")
R.CONFIG.get("browser")
R.DATABASE.get("db.url")
R.EMAIL.get("title")
R.TESTDATA.get("user.email")

The default config properties can be obtained by

Configuration.get(Parameter.BROWSER)

All the project configuration properties are located in a _config.properties file. In the table below we are providing a description of most of the parameters:

Attribute Meaning Example
url Base application URL http://qaprosoft.com
browser Browser for testing chrome / firefox / safari / iexplore
headless Run tests in headless browser mode. Enabled when headless=true. Default: false. Boolean
browser_language Browser language or nothing to use the English version by default. "es", "fr"
selenium_url Selenium/Appium server url http://localhost:4444/wd/hub
app_version Application version/build number for reporting 1.2.5
locale Locale for using L10N feature en_GB,de_DE,fr_FR
retry_interval Timeout interval between calling HTML DOM for the element.
Note: in ms. For mobile automation specify a number from 500-1000 range
Integer
auto_screenshot Global switch for taking screenshots. When disabled, screenshots will be captured only after failures Boolean
report_url Direct HTTP link to Jenkins workspace report folder. Automatically specified by CI http://localhost:8888/job /my_project/1/eTAF_Report
max_screen_history Max number of reports artifacts saving in history. Default: 10 Integer
env Environment specific configuration. More about this feature STAG, PROD, DEMO
ignore_ssl API requests/responses to ignore SSL errors. Default: false Boolean
driver_event_listeners Comma-separated list of extra driver listeners listeners. Listeners provide extra custom actions for WebDriver and have to be the instances of WebDriverEventListener com.some_company.core.EventListener
max_driver_count Max number of drivers per thread. Default: 3 Integer
driver_recorder Enable embedded carina recorder for driver session log/video artifacts generation. It is recommended to use for Selenium/Appium hubs which can't record such artifacts automatically. Default: false Boolean
forcibly_disable_driver_quit If enabled turns off webdriver shutdown after test finishing by any reason. Default: false Boolean
custom_capabilities Name of a properties file with custom capabilities (key-value) custom.properties
proxy_host Hostname of the server host.example.com
proxy_port Port number 80
proxy_protocols Comma-separated list of internet protocols used to carry the connection information from the source requesting the connection to the destination for which the connection was requested. http, https, ftp, socks
browsermob_proxy Boolean parameter which enables or disables the automatic BrowserMob proxy launch true, false
browsermob_port Port number for BrowserMob proxy (if nothing or 0 specified, then any free port will be reused) Integer
browsermob_ports_range Range of ports that will be used for starting of browsermob proxy. First available port from the range will be used. If all ports are used then test will wait for the first freed port. 8001:8003
proxy_set_to_system Boolean parameter which enables or disables the setup of a proxy true, false
no_proxy Excluded hostname(s) for communication via proxy. Available only when proxy_host and proxy_port are declared! localhost.example.com
explicit_timeout Timeout is seconds to wait for a certain condition to occur before proceeding further in the code Integer
auto_download The enabled parameter prevents downloading a dialog and downloading a file automatically. The feature is currently available for Chrome and FireFox false, true
auto_download_apps MIME types / Internet Media Types. The parameter is needed only to configure auto downloading for FireFox application/pdf, list of values
auto_download_folder Path to auto download folder for Chrome and Firefox browsers. If nothing specified custom_artifacts_folder or default artifacts folder is used String
project_report_directory Path to a folder where the testing report will be saved ./reports
big_screen_width Screenshots will be resized according to this width if their own width is bigger. Default: -1 to keep existing size. Integer
big_screen_height Screenshots will be resized according to this height if their own height is bigger. Default: -1 to keep existing size. Integer
init_retry_count Number of attempts to create a driver. The default value 0 means that there will be only 1 attempt Integer
init_retry_interval Interval in seconds between the attempts to create a driver Integer
retry_count Number of test-retryings in case of failure. The default value 0 means that a test will be performed only once Integer
thread_count Default number of threads to use when running tests in parallel. Set thread-count=custom to disable any updates on carina side. Integer
data_provider_thread_count Default number of threads to use for data providers when running tests in parallel. Integer
core_log_level Level for Carina logging ALL, DEBUG, ERROR, WARN, FATAL, INFO, OFF, TRACE
log_all_json API response will be logged in JSON format. Default: true Boolean
date_format Date format for DateUtils.class HH:mm:ss dd/MM/yyyy, HH:mm MM/dd/yyyy
time_format Date format for DateUtils.class HH:mm:ss.SSS, HH:mm a zzz
crypto_key_path Path to a file with a crypto key ./src/main/resources/crypto.key
suite_name Suite name for the report and TestRail. If this parameter is NULL, will be taken from TestNG xml (the parameter suite name) or _email.properties (the title) Advanced Acceptance
access_key_id Access key id for Amazon S3 build uploader. More info here gkhcvdgvceUYF67897hbjsbdc
secret_key Secret key for Amazon S3 build uploader. More info here gkhcvdgvceUYF67897hbjsbdc
appcenter_token Token for authentication in Hockey App gkhcvdgvceUYF67897hbjsbdc
Encoding for a new localization UTF-8
localization_testing Enables auto verification for elements that are marked with @Localized true, false
tls_keysecure_location Path to a directory with tls secure keys ./tls/keysecure
health_check_class Class to execute health checks Custom class
health_check_methods Comma-separated list of methods of health_check_class to execute preliminarily doThis, doThat
test_run_rules Executing rules logic: test_run_rules={RULE_NAME_ENUM}=>{RULE_VALUE1}&&{RULE_VALUE2};;... test_run_rules=PRIORITY=>P1&&P2&&P4;;OWNER=>owner;;TAGS=>tag1=temp||!!feature=reg
element_loading_strategy Determines how carina detects appearing of web elements on page: by presence in DOM model or by visibility or by any of these conditions BY_PRESENCE, BY_VISIBILITY, BY_PRESENCE_OR_VISIBILITY
page_opening_strategy Determines how carina detects whether expected page is opened: by expected url pattern, by marker element loading state or by both these conditions BY_ELEMENT, BY_URL, BY_URL_AND_ELEMENT
Most of the properties may be read in the following way:

Configuration.get(Parameter.URL) // returns string value
Configuration.getBoolean(Parameter.AUTO_SCREENSHOT) // returns boolean value
Configuration.getInt(Parameter.BIG_SCREEN_WIDTH) //return int value
Configuration.getDouble(Parameter.MAX_DRIVER_COUNT) // returns double value

Environment specific configuration

In some cases, it is required to support multiple environments for testing. Let's assume we have STAG and PROD environments which have different application URLs. In this case, we need to specify the following properties in _config.properties:

env=PROD
STAG.url=http://stag-app-server.com
PROD.url=http://prod-app-server.com

And get an env-specific argument in the test in the following way:

Configuration.getEnvArg("url")

As a result, you switch between the environments just changing the env argument in the _config.properties file.

Tests execution filter configuration

The test_run_rules parameter is responsible for filtering tests. There are 3 filter types: 1) PRIORITY - enum field (from P0 to P6) 2) OWNER - the test owner 3) TAGS - custom label

Example of how to attach labels in code:

@Test
@TestPriority(Priority.P3)
@MethodOwner(owner = "Josh")
@MethodOwner(owner = "Jake")
@TestTag(name = "feature", value = "web")
@TestTag(name = "type", value = "regression")
public void t4(){
    ...
    some code
    ...
}

test_run_rules parameter parse logic:

1) A simple filter:

test_run_rules=OWNER=>Josh
#Where OWNER is tag, and "=>" split's tag and rule part.
#Because of the "Josh" rule, test will be executed if it has Josh as owner

2) With negative logic:

test_run_rules=OWNER=>!!Josh
#Test will be executed if it hasn't got Josh as owner

3) With boolean logic:

#Use || or && to create more difficult rules
#where || == OR; && == AND.

test_run_rules=OWNER=>Josh||Jake
#Test will be executed if it has at least Josh or Jake as owner.

test_run_rules=OWNER=>Josh&&Jake
#Test will be executed if it has at least Jish and Jake as owner

test_run_rules=OWNER=>Josh&&Jake||Peter
#Expression will be processed in sequential priority, like
#test_run_rules=OWNER=>((Josh&&Jake)||Peter)
#So test will be executed if it has at least (Josh and Jake) or (Peter) as owner

4) To add more tags to the rule use ";;", example:

#;; works as && (AND) but for tags

test_run_rules=PRIORITY=>!!P1;;OWNER=>Josh&&!!Jake;;TAGS=>feature=web&&!!type=smoke||feature=android

#Test will be executed if it has
#1) no @TestPriority(Priority.P1)
#AND
#2) @MethodOwner(owner = "Josh") without @MethodOwner(owner = "Jake")
#AND
#3) (@TestTag(name = "feature", value = "web") without @TestTag(name = "type", value = "smoke"))
        or @TestTag(name = "feature", value = "android")        

#In other words, will be executed tests with Priority that differs from P1, with Josh as owner if there no Jake 
#and if they are for not smoke web or if they are for android.

Zebrunner Reporting configuration

agent.properties file is used for Zebrunner Reporting integration, here you should specify some values for a proper integration:

Attribute Meaning Example
reporting.enabled Root switch true/false
reporting.server.hostname Service URL https://mycompany.zebrunner.com
reporting.server.access-token Access Token eyJhbGciOiJIUzUxMiJ9...
reporting.projectKey Project Name empty or any existing name

Tricks

Pass params through _config.properties, not in code.

Will work both:
1) putting parameters in _config.properties :
   selenium_url=http://localhost:4444/wd/hub
2) passing them right in the test:
public void testCompareModels() {
   R.CONFIG.put("selenium_url", "http://localhost:4444/wd/hub");
   HomePage homePage = new HomePage(getDriver());
   homePage.open();
   ...
}
Nevertheless, it is recommended to use the 1st variant for initialization of all the parameters.