Ad hoc test runs in the mabl CLI

Triggering ad hoc runs locally and in the cloud from the mabl CLI

The mabl CLI includes two commands for running tests ad hoc:

📘

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

OptionDetails
--idID of the test to run
--run-idID of the test run to pull configuration from
--from-plan-idRun tests associated with a specific plan. The environment ID and credentials ID associated with the plan are used as well unless supplied.
--mabl-branchMabl branch to run the test against.
--branch-changes-onlyUse with the --mabl-branch option. Exclude tests that do not exist on the specified branch. The default value is false.
--labelsRun any tests that match the space-delimited list of labels.
--exclude-labelsExclude any tests that match the space-delimited list of labels.
--environment-id, -eMabl environment to run under. By specifying the environment, you can ensure that the test runs with environment variables and the latest find information.
--widthSet the browser width in pixels.
--heightSet the browser height in pixels.
--url, -uURL to run the mabl test against.
--credentials-id, --credsCredentials to run the test with.
--data-table-idRun the test using all the scenarios from the DataTable ID.
--scenario-idRun the test using a specific DataTable scenario.
--basic-auth-credentials-id, --basic-credsBasic authentication credentials to run the test with.
--headlessRun the test in the background without opening a browser window. The default value is false.
--highlightsHighlight elements before interacting with them. Note that highlighting introduces a small delay for each step. The default value is false.
--keep-browser-openPrevent the browser from closing at the end of a test. The default value is false.
--enable-browser-extensionsEnable browser extensions on Chrome and Edge. The default value is false.
--http-headersSpace-delimited HTTP headers added to browser requests. For example: "x-header: foo"
--user-agentEmulates a custom user-agent.
--interaction-speedSet 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 alphabetical order. Advanced plan configurations, such as stages, browser settings, or shared variables, are not adhered to.

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

OptionDetails
--idID of the test to run
--deployment-id, -dDeployment to run the mabl tests against
--url, -uAlias for app-url
--app-urlWeb application URL to run the mabl test against
--api-urlAPI URL to run the mabl test against
--basic-auth-credentials-id, --basic-credsBasic authentication credentials to run the test with.
--browsers, -bSpace delimited browsers to run the test against. The default is "chrome."
--api-key, -kAPI key for authenticating the command in a script.
--mabl-branchMabl branch to run tests against
--branch-changes-onlyUse with the --mabl-branch option. Exclude tests that do not exist on the specified branch. The default value is false.
--revision, --revAssociate the test run with a specific git commit hash or revision ID.
--application-id, -aMabl application to run under.
--environment-id, -eMabl environment to run under. By specifying the environment, you can ensure that the test runs with environment variables and the latest find information.
--credentials-id, --credsCredentials ID to run the test with.
--promptPrompt 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, --yesDo 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