The mabl CLI includes two commands for running tests ad hoc:
-
mabl tests run
: triggers ad hoc local runs -
mabl tests run-cloud
: triggers ad hoc cloud runs
The mabl CI runner
You can also run tests from the mabl CLI within your CI/CD container or server using the mabl CI runner. For more information on this method of executing tests, click here.
mabl tests run
The mabl tests run
command triggers a local ad hoc run and logs the output and results in the terminal window.
Options
Option | Details |
---|---|
--id |
ID of the test to run |
--run-id |
ID of the test run to pull configuration from |
--from-plan-id |
Run tests associated with a specific plan. Running tests with the --from-plan-id option is not a plan run. Advanced plan configurations, such as stages, browser settings or shared variables, are not applied. |
--mabl-branch |
mabl branch to run the test against. |
--branch-changes-only |
Use with the --mabl-branch option. Exclude tests that do not exist on the specified branch. The default value is false. |
--labels |
Run any tests that match the space-delimited list of labels. |
--exclude-labels |
Exclude any tests that match the space-delimited list of labels. |
--environment-id , -e
|
mabl environment to run under. Specify to ensure the test runs with the correct environment variables and the latest find information. Note: setting the environment does not override the default URL. To override the URL, use the --url or -u option. |
--locale |
Locale to run the test in, such as "en-US" |
--timezone-id |
Identifier of the timezone to run the test in, such as "America/Buenos Aires" |
--width |
Set the browser width in pixels. |
--height |
Set the browser height in pixels. |
--url , -u
|
URL to run the mabl test against. |
--credentials-id , --creds
|
Credentials to run the test with. |
--data-table-id |
Run the test using all the scenarios from the DataTable ID. |
--scenario-id |
Run the test using a specific DataTable scenario. |
--basic-auth-credentials-id , --basic-creds
|
Basic authentication credentials to run the test with. |
--headless |
Run the test in the background without opening a browser window. The default value is false. |
--highlights |
Highlight elements before interacting with them. Note that highlighting introduces a small delay for each step. The default value is false. |
--keep-browser-open |
Prevent the browser from closing at the end of a test. The default value is false. |
--enable-browser-extensions |
Enable browser extensions on Chrome and Edge. The default value is false. |
--http-headers |
Space-delimited HTTP headers added to browser requests. For example: "x-header: foo" |
--user-agent |
Emulates a custom user-agent. |
--interaction-speed |
Set the speed that mabl interacts with webpages. Overrides test run settings if specified. |
--from-plan-id
The --from-plan-id option uses the plan information as a grouping mechanism only. It is not a plan run:
- Tests associated with the plan ID run sequentially in the same order that they appear on the plan details page in the mabl app.
- The mabl CLI does not apply advanced plan configurations, including stages, browser settings, or shared variables.
- All tests use the same base URL, which is the URL associated with the plan's application and environment. If the plan is configured with multiple URLs, the mabl CLI will use one of those URLs.
- If you include the --url option, all tests in the group use this URL.
Examples
# Trigger a headless local test run mabl tests run --id <test-id> --headless true # Trigger a local test run for tests matching a set of labels and exclude tests with the label "cleanup" mabl tests run --labels smoke needs-review --exclude-labels cleanup # Trigger a local test run for a specific DataTable scenario mabl tests run --id <test-id> --scenario-id <scenario-id>
Limitations
-
Browser support: Local test runs use the Chrome browser installed on your local machine. It is possible to update the browser path to a different Chromium browser, such as Microsoft Edge, using the command
mabl config set browser.path <path-to-browser>
. However, keep in mind that incorrectly configuring the browser path may break local test execution. - Sequential execution only: Local test runs do not support parallel execution.
mabl tests run-cloud
The mabl tests run-cloud
command triggers ad hoc cloud runs and provides a link to the test output in the mabl app.
Options
Option | Details |
---|---|
--id |
ID of the test to run |
--deployment-id , -d
|
Deployment to run the mabl tests against |
--url , -u
|
Alias for app-url
|
--app-url |
Web application URL to run the mabl test against |
--api-url |
API URL to run the mabl test against |
--basic-auth-credentials-id , --basic-creds
|
Basic authentication credentials to run the test with. |
--browsers , -b
|
Space delimited browsers to run the test against. The default is "chrome." |
--api-key , -k
|
API key for authenticating the command in a script. |
--mabl-branch |
mabl branch to run tests against |
--branch-changes-only |
Use with the --mabl-branch option. Exclude tests that do not exist on the specified branch. The default value is false. |
--revision , --rev
|
Associate the test run with a specific git commit hash or revision ID. |
--labels |
Run any tests that match the space-delimited list of labels. |
--exclude-labels |
Exclude any tests that match the space-delimited list of labels. |
--application-id , -a
|
mabl application to run under. |
--environment-id , -e
|
mabl environment to run under. Specify to ensure the test runs with the correct environment variables and the latest find information. Note: setting the environment does not override the default URL. To override the URL, use the --url or -u option. |
--credentials-id , --creds
|
Credentials ID to run the test with. |
--locale |
Locale to run the test in, such as "en-US" |
--timezone-id |
Identifier of the timezone to run the test in, such as "America/Buenos Aires" |
--prompt |
Prompt the mabl CLI to confirm execution selects before running the tests. This flag only applies to test runs that trigger multiple tests using the --labels option. The default value is true . |
--no-prompt , --yes
|
Do not prompt the mabl CLI to confirm execution selects before running the tests. This flag only applies to test runs that trigger multiple tests using the --labels option. |
Examples
# Trigger cloud runs of tests associated with a label and skip the confirmation prompt mabl tests run-cloud --labels smoke needs-review --no-prompt # Trigger cloud runs of a test on Chrome and Edge mabl tests run-cloud --id <test-id> --browsers chrome edge