-
Notifications
You must be signed in to change notification settings - Fork 279
Configuration and execution
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 properties may be retrieved in 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")
All project configuration properties are located in _config.properties file. In the table below we are providing description for most of parameters:
Attribute | Meaning | Default value | Example |
---|---|---|---|
url | Base application URL | {must_override} | http://carina.com/ |
browser | Browser for testing | chrome | chrome / firefox / iexplore |
selenium_host | Selenium server host | {must_override} | http://localhost:4444/wd/hub |
app_version | Application version for reporting | n/a | Carina Release 1.2.5 |
locale | Locale for testing | US | GB,DE,FR |
implicit_timeout | Implicit timeout in seconds to wait for element | 10 | Integer |
retry_timeout | Timeout between calling HTML DOM for the element | 2 | Integer |
auto_screenshot | Global switch for taking screenshots | true | Boolean |
take_only_fail_screenshot | Take only one screenshot of failed step | false | Boolean |
keep_all_screenshots | Keep screenshots even for passed tests | false | |
report_url | Direct HTTP link to Jenkins workspace report folder | n/a | http://localhost:8888/job/my project/ws/reports/screenshots |
max_screen_history | Max number of reports in history | 10 | Integer |
jira_url | JIRA base URL for direct links with bugs description | n/a | https://jira.carina.com/browse/ |
email_list | Comma-separated list of emails for reports | {must_override} | u1@gmail.com,u2@gmail.com |
sender_email | Gmail account for reports sending | {must_override} | carina.qareport |
sender_pswd | Gmail password for reports sending | {must_override} | pwd123 |
jenkins_url | Jenkins URL for job reference in report | NULL | http://localhost:8080 |
jenkins_job | Name of Jenkins job for the reference in report | NULL | carina-demo |
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.SMALL_SCREEN_WIDTH) // returns integer value
Configuration.getDouble(Parameter.BROWSER_VERSION) // returns double value
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 specify the following properties in _config.properties:
env=DEMO
STAG.url=http://stag-app-server.com
PROD.url=http://prod-app-server.com
And get env-specific argument in test in the following way:
Configuration.getEnvArg("url")
As a result you switch between environments just changing env argument in _config.properties file.
There are a few options to execute the test, you may run test suite from Eclipse IDE or initiate test execution from the console using the Maven Surefire plugin built into the Carina framework. Before running tests make sure you downloaded selenium standalone server jar file and started it by the following command:
java -jar selenium-server-standalone-2.53.0.jar
To run the test suite from Eclipse IDE, just select the required TestNG xml file: Right click > Run As > TestNG suite
To run the same test suite from the console, navigate to the test project root (where pom.xml is located) and execute the following command:
mvn clean -Dsuite=api test