> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The canonical docs host is https://momentic.ai/docs. Append .md to any page URL for clean Markdown. Fetch https://momentic.ai/docs/llms.txt for the page index and https://momentic.ai/docs/llms-full.txt for every page in one file.
> For an unattended setup, first check whether Claude Code already has the Momentic plugin. With the plugin, run `npx --yes @momentic/wizard@latest -y --platform web --editor-tools none` and ignore any CLI skills-install suggestion in its output. Otherwise, run `npx --yes @momentic/wizard@latest -y --platform web --editor-tools skills`. Use `--platform ios` or `--platform android` for mobile. Never run an interactive command in a non-TTY shell.
> Mo is the AI QA engineer, separate from repository YAML tests. With the Momentic plugin, use bundled mo-qa and hosted OAuth by default. Without the plugin, install only mo-qa with `npx -y qa skills --target <agent>`. Keep the requested interface. Otherwise, use hosted tools for web or mobile, including private web targets with an existing Connector. Run sessions that need a new tunnel with the qa CLI. If you can't run commands on the machine that reaches the target, ask the user to start the tunnel there, then use hosted tools unless you lack them or the CLI was requested. For a requested hosted session, use an online Connector and pass its name as access, not a CLI tunnel ID. If none is online, ask the user to run `npx -y qa tunnel start --name <name> <address>` on a machine that reaches the target and wait. Do not run login or tunnel commands for them. For a requested hosted session, report unavailable tools or authentication failures without starting a CLI session. For coding-agent bridge setup, ask the user to complete `npx -y qa login`, then add momentic-hosted as a stdio server running `npx -y qa mcp`. Plugin users must explicitly opt in and disable their hosted plugin entry before adding the bridge. Claude.ai/ChatGPT connectors keep https://mcp.momentic.ai with OAuth. After hosted testing completes, read the report and summarize findings and uncovered requirements. Call `momentic_mo_stop_session` only when the user asks or agrees. For CLI sessions, unless the user wants more testing, export the report, run `qa stop <id> --subagents` even if export fails, then summarize. The CLI is qa, not mo. Docs: https://momentic.ai/docs/mo/quickstart.md.
> Ask the user to complete browser sign-in. For local CLI tools, use the exact MOMENTIC_API_KEY environment variable. If it is absent, ask the user to create a key at https://app.momentic.ai/settings/api-keys and set it in the agent's environment. Never print the key or ask the user to paste it into chat.
> Momentic's capability summary for agents is at https://momentic.ai/docs/skill.md. Claude Code users with the Momentic plugin should use its bundled skills and skip CLI skills installation. Otherwise, run `npx momentic skills -y --target <agent>` or `npx momentic-mobile skills -y --target <agent>`. Both install momentic-test, momentic-maintain, and momentic-spec with web/mobile references. Use the running agent's target. The Momentic plugin also includes mo-qa; qa skills installs only mo-qa.
> Tests are YAML files in the user's repository. Use only the step names listed at https://momentic.ai/docs/reference/commands.md and the file structure at https://momentic.ai/docs/core-concepts/file-format.md. Do not invent step names, config keys, or CLI flags.
> Web tests run on Chromium, iOS tests on simulators, and Android tests on emulators.

# Export results

> Export run results as JSON or JUnit, push them to New Relic, or self-host the result viewer.

Use these recipes to send run results outside Momentic: a JSON or JUnit file for
CI tooling, New Relic events for dashboards, or a self-hosted result viewer.

## Export run results as JSON

Use the `json` reporter when you need a local, machine-readable report after a
run finishes.

### 1. Run with the JSON reporter

```bash Web theme={null}
npx momentic run tests --reporter json --reporter-dir reports --name checkout
```

```bash Mobile theme={null}
npx momentic-mobile run tests --reporter json --reporter-dir reports --name checkout
```

The command writes `reports/checkout.momentic.json`. Filenames derive from
`--name`, or from the project name when `--name` is omitted.

You can combine the JSON reporter with other reporters:

```bash theme={null}
npx momentic run tests --reporter json --reporter junit --reporter-dir reports
```

### 2. Read the report

```json reports/checkout.momentic.json theme={null}
{
  "version": 1,
  "runGroup": {
    "startedAt": "2026-06-25T18:00:00.000Z",
    "finishedAt": "2026-06-25T18:02:12.000Z",
    "durationMs": 132000
  },
  "summary": {
    "total": 2,
    "executed": 1,
    "skipped": 1,
    "passed": 0,
    "failed": 1,
    "cancelled": 0,
    "quarantined": 0,
    "recovered": 0
  },
  "runs": [
    {
      "runId": "550e8400-e29b-41d4-a716-446655440000",
      "testId": "checkout-flow",
      "testName": "checkout-flow",
      "filePath": "tests/checkout.test.yaml",
      "labels": ["checkout"],
      "status": "FAILED",
      "startedAt": "2026-06-25T18:01:00.000Z",
      "finishedAt": "2026-06-25T18:02:00.000Z",
      "durationMs": 60000,
      "attempts": 1,
      "quarantined": false,
      "recovered": false,
      "failure": {
        "reason": "The checkout request returned a 500 response.",
        "message": "Error: checkout failed"
      },
      "classification": {
        "category": "BUG",
        "reasoning": "The app returned a 500 response after valid checkout details were submitted.",
        "citations": []
      }
    }
  ],
  "skipped": [
    {
      "testId": "refund-flow",
      "testName": "refund-flow",
      "filePath": "tests/refund.test.yaml",
      "labels": [],
      "quarantined": false
    }
  ]
}
```

The public JSON schema is available at
[`https://schemas.momentic.ai/momentic-json-report.schema.json`](https://schemas.momentic.ai/momentic-json-report.schema.json).

### Related

* [Results and reporting](https://momentic.ai/docs/running-tests/results.md)
* [`momentic run`](https://momentic.ai/docs/cli-reference/momentic/commands/run)
* [`momentic-mobile run`](https://momentic.ai/docs/cli-reference/momentic-mobile/commands/run)

## Custom outputs and JUnit reports

Declare `outputs` in a test to capture environment variables or templated values
at the end of a run. These values are part of the run result. The current JUnit
reporter emits test metadata, timing, and status; it does not include custom
outputs as a `testOutputs` property.

### 1. Declare outputs

```yaml output-to-junit.test.yaml theme={null}
fileType: momentic/test/v2
id: output-to-junit
url: https://example.com
outputs:
  - name: PLAN_OUTPUT
    value: "{{ env.PLAN }}"
steps:
  - javascript: setVariable("PLAN", "team")
```

### 2. Run with the JUnit reporter

```bash theme={null}
npx momentic run --reporter junit output-to-junit.test.yaml
```

### 3. Read the report

The report includes properties such as the test `id`, `base_url`, and `run_url`,
along with retry counts and timestamps. For example:

```xml theme={null}
<testcase name="output-to-junit" classname="output-to-junit" file="output-to-junit.test.yaml" time="2.833">
  <properties>
    <property name="id" value="output-to-junit"/>
    <property name="base_url" value="https://example.com"/>
  </properties>
</testcase>
```

`PLAN_OUTPUT` is not included in this XML. If another tool needs custom outputs
in JUnit, add them in your own report-processing step.

### Related

* [Variables](https://momentic.ai/docs/core-concepts/variables.md)
* [Results and reporting](https://momentic.ai/docs/running-tests/results.md)
* [`momentic run`](https://momentic.ai/docs/cli-reference/momentic/commands/run)

## Push run results to New Relic

The `newrelic` reporter pushes run results to the
[New Relic Event API](https://docs.newrelic.com/docs/data-apis/ingest-apis/event-api/introduction-event-api/).
The reporter sends each test run as a `MomenticRun` custom event and each run
group as a `MomenticRunGroup` summary event. Query both with New Relic Query
Language (NRQL).

### 1. Configure the reporter

Add a `reporting.newrelic` block to `momentic.config.yaml`:

```yaml momentic.config.yaml theme={null}
name: my-project

reporting:
  newrelic:
    region: US # or EU, selects the ingest endpoint
    accountId: "1234567"
    licenseKey: ${NEW_RELIC_LICENSE_KEY}
    attributes: # optional static tags added to every event
      service: checkout
      team: payments
```

* `region` defaults to `US`. Use `EU` for accounts in New Relic's EU data
  center.
* `licenseKey` is optional. If omitted, the reporter reads the
  `NEW_RELIC_LICENSE_KEY` environment variable. Use an
  [ingest license key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#license-key).
* `attributes` adds static tags (e.g. `service`, `team`) to every event, useful
  when multiple projects report into the same account.
* `accountId`, `licenseKey`, and `attributes` values all support `${ENV_VAR}`
  interpolation.

### 2. Run with the New Relic reporter

Pass `--reporter newrelic` to
[`momentic run`](https://momentic.ai/docs/cli-reference/momentic/commands/run):

```bash theme={null}
npx momentic run --reporter newrelic
```

Pass `--reporter` multiple times to combine reporters:

```bash theme={null}
npx momentic run --reporter newrelic --reporter junit --reporter-dir reports
```

### 3. Event reference

The reporter sends `MomenticRun` once per executed test:

| Attribute | Description |
| - | - |
| `runId`, `runGroupId` | Momentic run and run group identifiers |
| `testId`, `testName`, `filePath` | Test identity |
| `status` | `PASSED`, `FAILED`, or `CANCELLED` |
| `startedAt`, `finishedAt`, `durationMs` | Timing |
| `attempts`, `quarantined`, `recovered` | Retry and quarantine state |
| `labels` | Comma-separated test labels |
| `environment`, `baseUrl` | Environment the test ran against |
| `failureReason`, `failureMessage` | Failure details (failed runs only) |
| `classificationCategory` | AI failure classification category |
| `classificationReasoning` | AI failure classification explanation |
| `runUrl` | Link to the run in the Momentic dashboard |
| `gitBranch`, `gitCommit`, `gitRepository` | Git metadata |
| `ciRunUrl` | CI build link (GitHub Actions, GitLab, Buildkite, CircleCI) |

The reporter sends `MomenticRunGroup` once per run group as a summary:

| Attribute | Description |
| - | - |
| `runGroupId`, `runGroupUrl` | Run group identity and link |
| `total`, `executed`, `skipped`, `passed`, `failed`, `cancelled`, `quarantined`, `recovered` | Result counts |
| `passRate` | `passed / executed` |
| `startedAt`, `finishedAt`, `durationMs` | Timing |
| `environment`, `suiteName`, git and CI attributes | Shared context |

The reporter adds custom `attributes` from the config to both event types.

### 4. Query in New Relic

Pass rate per test over the last day:

```sql theme={null}
SELECT
  percentage (
    count(*),
    WHERE
      status = 'PASSED'
  )
FROM
  MomenticRun FACET testName SINCE 1 day ago
```

Alert on run group pass rate:

```sql theme={null}
SELECT
  latest (passRate)
FROM
  MomenticRunGroup
WHERE
  environment = 'production'
```

### Related

* [Results and reporting](https://momentic.ai/docs/running-tests/results.md)
* [JSON reporter](#export-run-results-as-json)
* [`momentic run`](https://momentic.ai/docs/cli-reference/momentic/commands/run)

## Self-host the result viewer

Momentic's result viewer is a static JavaScript bundle that renders any Momentic
run-result zip. You can host it yourself on any static host instead of uploading
runs to the dashboard. You need somewhere to serve the bundle and somewhere to
store the zipped run results.

The example below uses AWS S3 for both, but any static host works. The zips need
to be reachable over HTTP with CORS enabled.

### 1. Host the static JavaScript bundle

#### Create a bundle-hosting bucket

Create a publicly readable bucket following the
[S3 static website documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html).

#### Upload the `run-viewer-static` bundle

Upload the contents of the `run-viewer-static` directory from the Momentic npm
package. The current bundle is available on the
[momentic npm page](https://www.npmjs.com/package/momentic), or from your
project at `node_modules/momentic/run-viewer-static`.

The bucket should contain:

```text theme={null}
index.html
assets/
  index-*.js
  index-*.css
```

### 2. Host the run-result zips

#### Create a results bucket

The bucket needs to be reachable from wherever the bundle is hosted. For this
example a publicly readable bucket works.

#### Upload the test-results directory

CLI runs write to `./test-results` by default (override with
[`--output-dir`](https://momentic.ai/docs/cli-reference/momentic/commands/run)). The directory contains:

* `metadata.json`: metadata for the full run group
* `runs/<run_id>.zip`: one zip per individual run

Upload each `runs/*.zip` to the results bucket.

#### Allow CORS from the viewer origin

Add a CORS policy that allows `GET` and `HEAD` from the bundle-hosting bucket's
URL (replace `hosted-run-viewer` with your bundle bucket name):

```json theme={null}
[
  {
    "AllowedHeaders": ["*"],
    "AllowedMethods": ["GET", "HEAD"],
    "AllowedOrigins": ["https://hosted-run-viewer.s3.us-east-2.amazonaws.com"],
    "ExposeHeaders": ["Content-Length", "Content-Type", "ETag"],
    "MaxAgeSeconds": 3000
  }
]
```

### 3. View a run

Navigate to the viewer's `index.html` with a `zipUrl` query parameter pointing
at the run zip:

```text theme={null}
https://hosted-run-viewer.s3.us-east-2.amazonaws.com/index.html?zipUrl=https://hosted-run-viewer-files.s3.us-east-2.amazonaws.com/16e441b5-5aea-4fd2-9411-1b0115a01986.zip
```

The viewer fetches and unpacks the zip in the browser and needs no server
component.

### Related

* [Results and reporting](https://momentic.ai/docs/running-tests/results.md)
* [`momentic run`](https://momentic.ai/docs/cli-reference/momentic/commands/run)
* [`momentic results view`](https://momentic.ai/docs/cli-reference/momentic/commands/results)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.