---
title: "Your whole suite runs from one command."
description: "Run Momentic tests with npx momentic run. Shard across CI jobs, filter by label, pick tests from a git diff, and write JUnit or Allure reports."
canonical: "https://momentic.ai/cli"
last-updated: "2026-09-13T12:56:02-07:00"
---

# Your whole suite runs from one command.

URL: https://momentic.ai/cli

platform   / cli

Tests are YAML files in your repo, so npx momentic run behaves the same on your laptop and on a CI runner. A failing test exits non-zero, which is all your pipeline needs to stop a bad merge.

[Try for free](https://app.momentic.ai/signup) [Get a demo](/sales)

Web, iOS and Android · GitHub Actions · GitLab CI · CircleCI · Jenkins · Buildkite

## Runs on the machines you already have.

117,010   bugs caught before deploy

70M+

Test runs executed

80k+

PRs verified

1000s

Parallel browsers

4

Report formats

## From install to a passing pipeline.

The CLI reads momentic.config.yaml, collects the test files in your project, and runs them. Everything the run needs sits in your repo and on the machine you start it from.

01

### Install the runner

Add momentic to devDependencies and run npx momentic init to write momentic.config.yaml. Mobile projects install momentic-mobile instead.

02

### Keep the tests in the repo

Each test is a YAML file next to your code. Engineers edit it by hand, and Cursor, Claude Code and Codex write it through our MCP server.

03

### Run locally, then gate the merge

npx momentic run takes a file path, a name, or --labels smoke. In CI, split the suite with --shard-index and --shard-count, then send the run to the dashboard with --upload-results.

## What the CLI gives you.

Flags for the work engineers do every day: pick a subset, choose the tests a diff can affect, split a long suite, and hand the results to the tooling you already run.

### Local runs first

npx momentic run login-flow starts one test against your dev server. Add --parallel auto to size workers from the host CPU count, and --url-override to point the same test at a preview deployment.

The same runner on your laptop and in CI.

### Pick the tests that matter

Filter by file path, by test name, or by label. --include and --exclude take regex patterns, and momentic list shows what a pattern matches before you run it.

Run the 12 tests your change touches instead of all 400.

### Tests chosen from your diff

--ai-select reads the diff against your pull request base and runs the in-scope tests that cover the change. --ai-select-dry-run measures that choice against your own CI history first.

The pipeline runs the tests your diff can affect.

### Sharding built in

--shard-index and --shard-count split the suite across CI jobs. --run-group-id stitches separate invocations back into one run in the dashboard.

A 40-minute suite fits inside a 5-minute job.

### Reports your pipeline can read

The CLI writes JUnit XML, Allure, Playwright JSON, or Buildkite JSON into --output-dir. --upload-results sends videos, traces and auto-heal history to the dashboard.

Failures appear where your team already looks.

### Exit codes you can trust

A failed test exits non-zero. Quarantined tests still run without breaking the build, and classification can keep an intended UI change from failing the pipeline.

A failed pipeline means a real regression.

Teams that gate every merge from the terminal.

Engineering teams run Momentic on pull requests, on main, and on a schedule.

“Momentic gave us a  fast and reliable  way to validate Poe.com's AI responses, even when they weren't deterministic.”

Momoko F.   Head of Product Operations, Quora

30 min

daily test execution, down from 7 hours

500+

manual test cases replaced

100%

critical tests created in one month

[30 min   daily test execution, down from 7 hours   "Momentic gave us a fast and reliable way to validate Poe.com's AI responses, even when they weren't deterministic."  Momoko F. Head of Product Operations, Quora](/customers/quora)

[8x   increase in release cadence   "It's like giving someone your QA checklist and watching them execute it for you!"  Sriram S. Engineering Lead, Source Control, Retool](/customers/retool)

[80%   faster release cycles   "With Momentic, we've caught bugs that would have eluded even our most diligent internal tests."  Alex C. CTO, GPTZero](/customers/gptzero)

[6x   faster end-to-end test creation   "We've already seen a 30% decrease in production incidents thanks to Momentic's automated testing."  Hanna K. Head of QA, CoverGo](/customers/covergo)

[85%   reduction in production incidents   "Momentic gives us reliable end-to-end coverage, so we can focus on features instead of maintaining tests."  Alec H. Staff AI Engineer, Mutiny](/customers/mutiny)

[Browse all](/customers)

## Available across every platform.

Same YAML. Same flags. Same runner.

[01   Web    End-to-end browser testing on Chromium and Chrome.](/web-app-testing)[02   iOS    Native iOS apps and SwiftUI, on hosted or local simulators.](/ios-testing)[03   Android    Reliable Android tests on local or remote emulators in minutes.](/android-testing)

## The CLI, answered.

How do I install the CLI?    Add momentic to devDependencies, then run npx momentic init to write momentic.config.yaml. For iOS and Android, install momentic-mobile.    What does momentic run do?    It reads momentic.config.yaml, collects the YAML tests in the project, runs them in a browser, and writes results to a local directory. Pass --upload-results to send the run to the dashboard.    Where do the tests live?    In your repo, as YAML files beside your code. You review a test change in a pull request like any other file.    Do I need an API key to run tests?    Yes. Set MOMENTIC_API_KEY in your shell or in your CI secrets.    How do I run only some of the tests?    Pass a file path, a test name, or --labels smoke. --include and --exclude accept regex patterns over file paths.    Can I split the suite across CI jobs?    Yes. Pass --shard-index and --shard-count in a matrix job, write each shard to its own --output-dir, and group the invocations with --run-group-id.    Which report formats does the CLI write?    JUnit XML, Allure, Playwright JSON, and Buildkite JSON.    Can a coding agent run these commands?    Yes. Cursor, Claude Code and Codex reach the same commands through our MCP server, so an agent can write a test and run it in the same turn.    Does the CLI work with my CI provider?    Our docs cover GitHub Actions, GitLab CI, CircleCI, Jenkins, Buildkite, Azure DevOps, and Travis CI. Any runner that can execute npx momentic run works.    Can I run tests without a browser window?    Yes. The CLI runs a headless browser, so nothing opens on screen. Run npx momentic install-browsers once on a new machine or CI runner to install the browser and ffmpeg.    Can I get a video of one test run?    Yes. Give momentic run the file path or the test name, and pass --video true to keep the video. The default is --video on-fail, which keeps a video only for a failing test.    How do I pass secrets and environment variables to a run?    Define an environment in momentic.config.yaml and read values with ${NAME}. The value comes from your shell, from your CI secret store, or from an env file you keep out of Git. Export MOMENTIC_API_KEY the same way.    Can a CI job run mobile tests from the command line?    Yes. momentic-mobile run works on a CI runner against an Android emulator or an iOS simulator. Hosted runners have fewer cores, so the docs give timeout overrides for CI.    How do I run against a preview deployment?    Pass --url-override with the preview URL, or select a configured environment with --env.

Still have additional questions?

## Close the feedback loop.

Start for free, or book a demo and we'll run it against your app.

[Try for free](https://app.momentic.ai/signup) [Get a demo](/sales)
