Configuration
Create the config.json file anywhere in your project, and provide its relative path as a command-line argument: --config <relative_path_of_config.json>.
For Windows, replace all instances of forward-slashes(/) each with 2 backslashes(\).
Configuration file attributes
| Attribute name | Mandatory? | Type | Example |
|---|---|---|---|
featurePath | Yes | String | "./path/to/feature/dir" |
stepDefinitionPath | Yes | String | "./path/to/step_def/dir" |
supportFolderPath | Yes | String | "./path/to/support/dir" |
reportFolderPath | Yes | String | "./path/to/report/dir" |
browser | No | Array of Strings | [ "chrome", "firefox" ] |
tags | No | String | "@sanity" "@sanity @smoke" |
parallelType | No | String | "features" |
rerun | No | Boolean | true |
remoteAppiumHub | No | Object | { "address": "https://www.example-cloud.com/wd/hub", "port": 8081 } port is optional |
desiredCapabilities | No | Object | View below sample |
SAMPLE CONFIGURATION FILE (click to expand)
{
"configurations": {
"browser": ["chrome"],
"tags": "@sanity",
"featurePath": ["test/features/"],
"stepDefinitionPath": ["test/step_definitions/"],
"supportFolderPath": ["test/support"],
"reportFolderPath": "test/reports",
"rerun": true,
"remoteAppiumHub": {
"address": "https://www.example-cloud.com/wd/hub",
"port": 8081
},
"desiredCapabilities": {
"chrome": {
"browserName": "chrome",
"unhandledPromptBehavior": "accept"
},
"ios": {
"browserName": "Safari",
"platformName": "iOS",
"platformVersion": "14.1",
"deviceName": "iPhone 12",
"automationName": "XCUITest",
"startIWDP": true,
"newCommandTimeout": 30,
"safariAllowPopups": true
}
}
}
}
CLI arguments
| CLI argument | Description | Expected value type | Example |
|---|---|---|---|
--config /path/to/config.json | Mandatory configuration file that defines the location of feature, step-definition and hook files | String | --config ./config.json |
--browser [browsers] | Specify the browser name for the session (can be 'chrome', 'firefox', 'safari', 'edge', 'android', 'ios') | String | --browser chrome --browser chrome firefox (for parallel execution) |
--headless | Attempt to run a headless session (applicable for Chrome, Firefox) | Boolean (optional) | |
--tags <tags> | Provide select cucumber tags to be executed | String | e.g. --tags @sanity e.g. --tags "@smoke @sanity" (for multiple tags) |
--parallelType features | Provide this flag to run scenarios from a single feature within the same thread | String | e.g. --parallelType features |
--remoteAppiumHub <url> | Provide this flag to override the appium url even if one is provided in the config file | String | e.g. --remoteAppiumHub https://appium.samplehuburl.com/ |
--addDesiredCaps <desiredCapObject> | Add an entirely new desired capability object or add new attributes to an existing desired capability object | Stringified JSON | e.g. --addDesiredCap "{\"ios\":{\"secretKey\":\"shhd0ntte11any1\"}}" |
--rerun | Re-execute all failing tests one more time | Boolean (optional) | |
--cores <n> | Number of threads in execution during parallel run | Number (default: 2) | --cores 4 |
--retry <n> | Cucumber-js native retry mechanism to run any failed test scenario(s) | Number | --retry 3 |
--webhookUrl <url> | Slack webhook url for Slack notifications | String | --webhookUrl https://webhookurl.slack.com/blah/ |
--ciLinkTitle <title> | Set title of the Slack message forwarded using Slack webhook URL | String | --ciLinkTitle "Build 14" |
--ciLinkUrl <url> | Set hyperlink URL for the slack title | String | --ciLinkUrl https://jenkins/url |
Important: key-value pairs passed via CLI arguments will override the same key-value pairs provided in the configuration json file. For example, --browser chrome CLI argument will override any browser attribute setting in the configuration file.