Running tests
Running tests using the CLI
Step 1: Get an API key:
You will need an API key to authenticate against Momentic’s servers.
Step 2: Install browsers:
This will download the latest version of Chrome, Firefox, and WebKit browsers to your local machine.
Step 3: Run tests:
Make sure this is in the same directory as your ./momentic
directory.
Arguments
Argument | Description | Default |
---|---|---|
tests | One or more test identifiers. |
To use tests stored on your local file system, pass --local
and specify file paths to Momentic YAML files or folders that exist locally: npx momentic run --local momentic/hello-world.yaml
.
To use tests stored remotely on Momentic Cloud, pass --remote
and specify one or more test paths. A test path is a lowercased version of your test name where spaces are replaced with dashes: npx momentic run --remote hello-world
.
Options
Option | Description | Default |
---|---|---|
-r, --remote | Run tests remotely. The production version of this test will be queued for execution. | true |
-l, --local | Run tests locally. Useful for accessing apps on localhost. This option does not control where tests are read from (see <tests> argument documentation). | |
--shard-count <shardCount> . | Split the tests into separate shards for parallelizing when running with the --local flag. Each shard will run 1/shardCount of the total tests. | |
--shard-index <shardIndex> . | Which shard to run when using the --shard-count flag. | |
--input-csv <inputCsv> | Load test inputs from the specified file when running with the --local flag. | |
--no-report | Skip reporting test results to Momentic Cloud when running with the --local flag. | |
--start <start> | Arbitrary setup command that will run before Momentic steps begin. | |
--wait-on <waitOn> | URL to wait to become accessible before Momentic tests begin. | |
--wait-on-timeout <waitOnTimeout> | Max time in seconds to wait for the --wait-on URL to become accessible. | 60 |
--retries <retries> | Number of retries to attempt when running tests locally. Defaults to each test’s own retry configuration. | |
-p, --parallel <parallel> | When running with the --local flag, the number of tests to run in parallel. Defaults to 1. | 1 |
--env <env> | Name of the environment to use when running tests. | |
--url-override <urlOverride> | Fully qualified URL (e.g., https://www.google.com) to start all tests from. Overrides any default starting URL set from the test or environment. | |
--custom-headers HEADER-1=value HEADER-2=value | Add or override HTTP headers to be sent on every network request that occurs during the test. If this option is provided, you must use -- to separate the options from the test names provided (e.g. npx momentic@^0 run --custom-headers TEST=true -- my-test ). |
Was this page helpful?